Personal understanding of the return value of continuous bind

Some understanding of continuous bind: First paste the handwritten bind implementation you understand, and refer to the understanding of some bosses: Function.prototype.myBind = function(asThis, ...arg) { let _this = this; if (typeof _this !== 'function') { throw new Error('not a function'); } let newFn = function() { console.log('Pri ...

Added by nicandre on Tue, 08 Mar 2022 21:37:49 +0200

On the points needing attention in this binding

preface: This is a keyword in JavaScript. It is an object automatically generated inside the function body when the function runs. It can only be used inside the function body. In addition, this cannot be assigned during execution. Text: Default binding: Usually, in the case of separate or pure function calls, this points to the global ob ...

Added by Jaguar83 on Sun, 23 Jan 2022 05:57:39 +0200

Where does this point? Understand this point

preface js has flexible this direction and various usage scenarios. Although the concept is basic, it is very important. Many hidden bug s come from it. It is very necessary to understand the direction of this. If you can master this skillfully, the code will be more concise and elegant Who does this point to? There is a most popular saying ...

Added by patch2112 on Thu, 20 Jan 2022 15:41:57 +0200

call_apply_bind usage and differences

Usage and differences of call, apply and bind 1. Interaction Change the direction of this 2. Differences The difference between call and apply: the methods of accepting parameters are different. call receives multiple parameters Function.call(obj,[param1[,param2[,...[,paramN]]]]) apply receives an array list Function.ap ...

Added by malcolmboston on Mon, 03 Jan 2022 11:16:55 +0200

Talk about call, apply and bind

Q: what are the ways to change this point? Three (I know) call, apply, bind (not including es6 syntax explanation) When I reviewed these methods, I read a lot of blogs and discussions. The first two are well understood, but I took a little time to adapt to the customization of bind! Without much to say, start exploring: ...

Added by gkelley091565 on Sun, 12 Dec 2021 01:52:23 +0200

Vue front end development specification

Sorting based on Vue official style guide   1, Coercion 1. The component name is multiple words The component name should always be multiple words, except for the root component App. Positive example: export default { name: 'TodoItem', // ... } Copy code Counterexample: export default ...

Added by Xeoncross on Mon, 29 Nov 2021 06:23:37 +0200