How to set or update or push the values into Object in javacript

javascript
set
update
push
object

Object Basics

Here the values push to the object

var arr = []; // Declare the array
arr.push('value');

Here the value set into the object

arr[1].name = 'test';
console.log(arr[1].name);

Here the initilize the object

var var ={'id':1,'name':'test'};
console.log(var);

Display the all names from the object

var arr = [{name: 'test1'},{name: 'test2'}];
for(var i=0;i<arr.length;i++){
     console.log(arr[i].name+'<br>');
}

 

You might also like:

File Upload Using Angular Js and Node Js

28-05-2018 AngularJs Node js file upload multer module

How to upload file by using request module

18-03-2017 request module node js

How to get current date and time (yyyy-mm-dd H:i:s) using javascript

09-03-2017 javascript date time

Get next date from given date in javascript

06-03-2017 date javascript next date

How to change background color and color to the text using javascript

27-02-2017 css javascript colors