Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to push in to object js

var obj = {};
//pushing new item to the object
obj.newitem = 'this is my new item for the above object'
obj.arrItem = ['new item', 'another item', '3rd item']
obj.intItem = 1324

console.log(obj)
/*
{
	newitem: 'this is my new item for the above object',
	arrItem: array [ 
    0:'new item',
    1:'another item',
    2: '3rd item',
    ],
    intItem: 1234,
}
*/
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #push #object #js
ADD COMMENT
Topic
Name
8+3 =