public
Created — forked from arunoda/gist:1229406

Java Script Data Structures

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
 
// Arrays
 
var aaa = [];
 
// Stack
 
var aa = [10];
aa.push(20);
aa.pop(); //gets 20
 
// Queue
 
var aa = [10];
aa.push(20);
aa.shift(); //gets 10
 
// Map
 
var aa = {};
aa['arunoda'] = 10;
aa['soori'] = 40;
 
// Objects with JSON
 
var tweer = {
 
user: "arunoda",
status: "Hey dude",
date: new Date().getTime()
};

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.