Stop memorizing the difference between __proto__ and prototype. Starting from what `new` really does, we break down why the prototype chain exists, how it saves memory, and the real mechanics behind class syntactic sugar.
Posts tagged with JavaScript
JavaScript
Breaking down the four-step internal process of the `new` operator, revealing that `class` is essentially syntactic sugar over `function` + prototype binding.
call passes args with commas, apply passes args as an array, bind does not execute immediately. A crisp cheat sheet for the three hard-binding methods.
Stop memorizing rules. Starting from what `this` really means, we break down the four invocation patterns, the classic `this`-loss pitfall in classes, the essence of arrow functions, and when you should—and shouldn't—use them.
Hand-implementing JavaScript array core methods — forEach, map, filter, reduce — mounted on the prototype chain.