Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

mdn bind

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

module.getX(); // 81

const getX = module.getX;
getX(); // 9, porque en este caso, "this" apunta al objeto global

// Crear una nueva función con 'this' asociado al objeto original 'module'
const boundGetX = getX.bind(module);
boundGetX(); // 81
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript detect time on page 
Javascript :: update password before saving to mongodb 
Javascript :: unlimited number of arguments in function javascript 
Javascript :: js loop array back 
Javascript :: JS copy image 
Javascript :: javascript Modules Always use Strict Mode 
Javascript :: react-google-invisible-recaptcha 
Javascript :: recorrer array javascript 
Javascript :: patterns in javascript using for loop 
Javascript :: errorMessage is not defined 
Javascript :: freenom 
Javascript :: sum in javascript 
Javascript :: setup neovim vscode jj hotkey 
Python :: ignore warnings python 
Python :: seaborn rotate x labels 
Python :: pandas save file to pickle 
Python :: how to shutdown a computer with python 
Python :: merge on index pandas 
Python :: python clamp 
Python :: python replace all new lines with space 
Python :: python get utc time 
Python :: python read json 
Python :: how to open webcam with python 
Python :: python print exception message and stack trace 
Python :: boucle for python 
Python :: django no such table 
Python :: convert list of strings to ints python 
Python :: python delete folder 
Python :: how to shuffle dictionary python 
Python :: sklearn.utils.bunch to dataframe 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =