filmov
tv
Why arrow function can not be used to create object | Arrow function in JavaScript

Показать описание
Can we use an arrow function to create objects in JavaScript?
The answer is - NO
Unlike other functions, an Arrow function does not have the prototype object and is set to undefined.
Whenever we create objects from a function, newly created objects are linked to the function's prototype object. Since an arrow function prototype object is undefined, it can not be used as a constructor.
The following code gives an error.
var City () = {} // arrow function
var b = new City(); // error
Remember that an arrow function can not be used as a constructor.
The answer is - NO
Unlike other functions, an Arrow function does not have the prototype object and is set to undefined.
Whenever we create objects from a function, newly created objects are linked to the function's prototype object. Since an arrow function prototype object is undefined, it can not be used as a constructor.
The following code gives an error.
var City () = {} // arrow function
var b = new City(); // error
Remember that an arrow function can not be used as a constructor.
Why I Don’t Use Arrow Functions With const/let
Why arrow function can not be used to create object | Arrow function in JavaScript
When not to use Arrow Function || Javascript ES6 tutorial for beginners || Time For Code
JavaScript ES6 Arrow Functions Tutorial
Arrow Functions JavaScript Tutorial - What NOT to do!!!
Learn JavaScript ARROW FUNCTIONS in 8 minutes! 🎯
#26 Arrow function in JavaScript
3 Differences Between Arrow Functions And Regular Functions
⚙️ Introduction to Starknet Cairo Programming.
Excel Arrow Keys Not Moving Around Cells
Why I don't use arrow functions in JavaScript
JavaScript Arrow Functions in 1 Minute #shorts
16.3: ES6 Arrow Function - Topics of JavaScript/ES6
ES6 Arrow functions are really different - use it wisely
JavaScript Arrow Functions & 'this' Explained Simply
ES6 Tutorial #12 When not to use Arrow Functions
this Keyword in JS | this in Regular functions vs Arrow Functions |JavaScript Interview Series: EP-4
JS Arrow Functions: Everything You Need to Know
Arrow functions javascript tutorial what not to do
Modern Javascript Advanced working with functions 12 Arrow functions cannot be used for constructors
Arrow Functions VS Regular Functions
ES6 arrow functions - What you must know
Understanding Why Your Inline Arrow Function Is Not Changing States as Expected in Flutter
DON'T USE ARROW FUNCTIONS! #shorts #react
Комментарии