The bind() method of a Function object creates a new function that, when called, calls this function with its this keyword set to the provided value, and a given sequence of arguments preceding any provided when the new function is called.

    
    const module = {
      x: 42,
      getX: function () {
        return this.x;
      },
    };

    const unboundGetX = module.getX;

    // The function gets invoked at the global scope
    console.log(unboundGetX());
    // undefined

    const boundGetX = unboundGetX.bind(module);

    console.log(boundGetX());
    // 42