Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js dictionary

// Javascript Dictionary
Output : s_dict = { "var_name":1, "var_age": 50  }
//create
var s_dict = new Object();
// or
var s_dict = {};

// Add to Dictionary ('dict')
s_dict["var_name"] = 1;
// or 
s_dict[2] = 50;
// or
s_dict.var_name = 1

//Accessing Dictionary
foo = s_dict["var_name"]
// or
foo = s_dict.var_name

//Delete key from Dictionary
delete s_dict['var_name']
 
PREVIOUS NEXT
Tagged: #js #dictionary
ADD COMMENT
Topic
Name
5+1 =