What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-02-18 22:50:07
append object to object javascript
// Spread syntax allows an iterable (in this case an object) to be expanded const originalObj = { name: 'John', age: 34 } let newObj = { ...originalObj, city: 'New York' } // newObj is now { name: 'John', age: 34, city: 'New York' } // it can also be us... Add solution -
Javascript 2022-02-02 17:41:22
clone an object javascript
var student = {name: "Rahul", age: "16", hobby: "football"}; //using ES6 var studentCopy1 = Object.assign({}, student); //using spread syntax var studentCopy2 = {...student}; //Fast cloning with data loss var studentCopy3 =... Add solution -
Javascript 2022-01-27 19:50:26
ellipsis javascript
function sum(x, y, z) { return x + y + z; } const numbers = [1, 2, 3]; console.log(sum(...numbers)); // expected output: 6 console.log(sum.apply(null, numbers)); // expected output: 6 /* Spread syntax (...) allows an iterable such as an array expres... Add solution -
Javascript 2021-11-19 13:02:18
best way to clone an object in javascript
var student = {name: "Rahul", age: "16", hobby: "football"}; //using ES6 var studentCopy1 = Object.assign({}, student); //using spread syntax var studentCopy2 = {...student}; //Fast cloning with data loss var studentCopy3 =... Add solution -
Javascript 2021-10-21 15:06:13
ellipses in js
function sum(x, y, z) { return x + y + z; } const numbers = [1, 2, 3]; console.log(sum(...numbers)); // expected output: 6 console.log(sum.apply(null, numbers)); // expected output: 6 /* Spread syntax (...) allows an iterable such as an array expres... Add solution -
Javascript 2021-10-21 10:04:04
javascript append to object
// Spread syntax allows an iterable (in this case an object) to be expanded const originalObj = { name: 'John', age: 34 } let newObj = { ...originalObj, city: 'New York' } // newObj is now { name: 'John', age: 34, city: 'New York' } // it can also be us... Add solution -
Javascript 2021-10-19 19:31:03
what is ... in javascript
function sum(x, y, z) { return x + y + z; } const numbers = [1, 2, 3]; console.log(sum(...numbers)); // expected output: 6 console.log(sum.apply(null, numbers)); // expected output: 6 /* Spread syntax (...) allows an iterable such as an array expres... Add solution -
Javascript 2021-10-19 12:43:05
object clone javascript
var student = {name: "Rahul", age: "16", hobby: "football"}; //using ES6 var studentCopy1 = Object.assign({}, student); //using spread syntax var studentCopy2 = {...student}; //Fast cloning with data loss var studentCopy3 =... Add solution -
Javascript 2021-10-16 16:49:11
how to clone an object in javascript
var student = {name: "Rahul", age: "16", hobby: "football"}; //using ES6 var studentCopy1 = Object.assign({}, student); //using spread syntax var studentCopy2 = {...student}; //Fast cloning with data loss var studentCopy3 =... Add solution -
Javascript 2021-10-05 19:50:03
javascript clone object
var student = {name: "Rahul", age: "16", hobby: "football"}; //using ES6 var studentCopy1 = Object.assign({}, student); //using spread syntax var studentCopy2 = {...student}; //Fast cloning with data loss var studentCopy3 =... Add solution