JavaScript Copier un tableau
let arr =["a","b","c"];
// ES6 way
const copy = [...arr];
// older method
const copy = Array.from(arr);
Batman
let arr =["a","b","c"];
// ES6 way
const copy = [...arr];
// older method
const copy = Array.from(arr);
const sheeps = ['Apple', 'Banana', 'Juice'];
// Old way
const cloneSheeps = sheeps.slice();
// ES6 way
const cloneSheepsES6 = [...sheeps];
array.map((employee) => Object.assign({ }, employee))
workers = workers.map(employee =>
employee.occupation == "Iron Man" ? (employee.occupation = "Philantropist", employee) : (employee.occupation, employee)
);
element.baz = condition ? foo : bar;