Do not declare string, number or boolean with the 'new' keyword
When a variable is declared with the keyword 'new', the variable is created as an object.

var a = new string() 
var b = new number()
var c = new boolean()

A data structure can be easily created.
You can use key-value pairs that are separated with a colon.

var myObject = { name:"Monday", value:42.5}; 

When you are reading from an object you need to use square brackets

var myValues = myObject["name"] + "day"; 

You can use square brackets to add or update properties

myObject["name"] = "Tuesday"; 
myObject["anothernewproperty"] = "some text";

© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext