AmitDiwan has Published 10744 Articles

Can we modify built-in object prototypes in JavaScript

AmitDiwan

AmitDiwan

Updated on 18-Jul-2020 07:56:14

167 Views

Following is the code for modifying built-in object prototypes in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result {       font-size: 20px;       font-weight: 500;       ... Read More

De-structuring an object without one key

AmitDiwan

AmitDiwan

Updated on 18-Jul-2020 07:55:36

155 Views

Following is the code to de-structure an object without one key −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result, .sample {       font-size: 18px;       font-weight: 500;     ... Read More

Adding methods to Javascript Prototypes

AmitDiwan

AmitDiwan

Updated on 18-Jul-2020 07:54:11

104 Views

Following is the code for adding methods to JavaScript prototypes −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result {       font-size: 20px;       font-weight: 500;       color: ... Read More

Sum of nested object values in Array using JavaScript

AmitDiwan

AmitDiwan

Updated on 18-Jul-2020 07:53:21

990 Views

Following is the code to sum nested object values in array using JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result {       font-size: 18px;       font-weight: 500;   ... Read More

Function prototypes in JavaScript

AmitDiwan

AmitDiwan

Updated on 18-Jul-2020 07:52:35

242 Views

Functions created in JavaScript always have the prototype property added by the JavaScript engine to them. The prototype property is an object which contains the constructor property by default. The function protoype can be accessed by −functionName.prototypeWhen objects are creating using the function constructor, this prototype property can be used ... Read More

Anonymous Wrapper Functions in JavaScript

AmitDiwan

AmitDiwan

Updated on 18-Jul-2020 07:50:17

809 Views

Anonymous functions are used to wrap code snippets, JavaScript libraries, functions etc to control their visibility and the namespace so that there shouldn’t be any conflict with other libraries code. IIFE (Immediately Invoked Function Expressions) are used for this purpose.Following is the code to implement Anonymous Wrapper Functions in JavaScript ... Read More

Implement Private properties using closures in JavaScript

AmitDiwan

AmitDiwan

Updated on 18-Jul-2020 07:48:37

144 Views

Following is the code to implement private properties using closures in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result {       font-size: 20px;       font-weight: 500;     ... Read More

Using ‘{ }' in JavaScript imports?

AmitDiwan

AmitDiwan

Updated on 18-Jul-2020 07:47:41

147 Views

Following is the code using {} in javaScript imports −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result {       font-size: 18px;       font-weight: 500;       color: rebeccapurple; ... Read More

When you should not use JavaScript Arrow Functions?

AmitDiwan

AmitDiwan

Updated on 18-Jul-2020 07:44:25

178 Views

The arrow functions should not be used as an object method because an arrow function does not have its own this. It takes this value of the enclosing lexical scope which is the window object instead of the object itself. This can cause problems as we would now be setting ... Read More

How to import an Object with Sub Objects and Arrays in JavaScript?

AmitDiwan

AmitDiwan

Updated on 18-Jul-2020 07:43:56

592 Views

Following is the code for importing an object with Sub objects and arrays in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result{       font-size: 18px;       font-weight: 500; ... Read More

Advertisements