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:

Time Sorting Ascending or Descending Order in Javascript

19-07-2017 Javascript ascending order descending order

How to redirect one page to another page in php

20-03-2017 redirect php

How to make an http request in node js

14-03-2017 http module node js

Using slice remove last two characters from given string

07-03-2017 slice remove

Filter for replace text in Angular Js

05-03-2017 filter replace angular js