Blog
Archive for the JavaScript Category
Way to use a prototype (__proto__ property on an object):
function userCreator(new, score) {
const newUser = Object.create(userFunctionStore);
newUser.name …
Read more
Object literal
Dot notation
Object.create
// Create an empty object
const user3 = Object.create(null); // const user3 = {};
Generate an Object with a Function …
Read more
Rest operator: collects all remaining elements into an array.
See the code example below:
function returnArr(…arr) {
return arr;
}
returnArr(1,2,3,4); // [1,2,3,4];
Spread operator: allows iterables …
Read more
Array destructuring is the assignment part of a variable, not the declaration part.
// Non-destructured code
function data() {
return [1,, …
Read more
Definition from MDN:
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from …
Read more