let person = { firstName: 'Rocky', lastName: 'g', age: 23 }; let job = { jobTitle: 'Angular Developer', location: 'UK' }; let employee = { ...person, ...job }; console.log(employee);
Here inserting the element after shruthi var arr = []; arr[ 0 ] = "uday" ; arr[ 1 ] = "shruthi" ; arr[ 2 ] = "Riyansh" ; arr[ 3 ] = "Rithika" ; arr[ 4 ] = "Tagore" ; console . log (arr. join ()); // uday,shruthi,Riyansh,Rithika,Tagore arr. splice ( 2 , 0 , "Rocky" ); console . log (arr. join ()); // uday,shruthi,Rocky,Riyansh,Rithika,Tagore