What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-20 15:26:09
array of objects to object
const names = ['Alex', 'Bob', 'Johny', 'Atta']; // convert array to th object const obj = Object.assign({}, names); // print object console.log(obj); // {0: "Alex", 1: "Bob", 2: "Johny", 3: "Atta"} 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-11-19 06:23:18
convert array to object in javascript
const names = ['Alex', 'Bob', 'Johny', 'Atta']; // convert array to th object const obj = Object.assign({}, names); // print object console.log(obj); // {0: "Alex", 1: "Bob", 2: "Johny", 3: "Atta"} Add solution -
Javascript 2021-11-01 09:59:08
word to char array javascript
const string = 'hi there'; const usingSplit = string.split(''); const usingSpread = [...string]; const usingArrayFrom = Array.from(string); const usingObjectAssign = Object.assign([], string); // Result // [ 'h', 'i', ' ', 't', 'h', 'e', '... Add solution