Skip to Content
0
May 11, 2020 at 07:20 AM

How to add new value in first index array of objects in javascript

44 Views

var myobjs=[{

name:mohan,

age:28,

},

{name:ram,

age:28,

dept:csc},

{name:jhon,

age:28,

dept:mech}];

how can i insert dept in the first index of the object in java script

i want output like this

{name:mohan,

age:28,

dept:csc

},

{name:ram,

age:28,

dept:csc},

{name:jhon,

age:28,

dept:mech};