Skip to content

Instantly share code, notes, and snippets.

@mjzone
Last active July 3, 2016 06:46
Show Gist options
  • Save mjzone/eb77965bc2bd866c2e4739ca84179937 to your computer and use it in GitHub Desktop.
Save mjzone/eb77965bc2bd866c2e4739ca84179937 to your computer and use it in GitHub Desktop.
var person = new Object();
person.name = 'Manoj';
console.log(person) //Result: Object {name: "Manoj"}
var ages = new Array(10);
console.log(ages) // Result: [,,,,,,,,,,] gotcha!
// Always use JSON format.
var person = {
name: 'Manoj'
}
console.log(person) //Result: Object {name: "Manoj"} (This calls new behind the scene and return new object)
var ages = [10];
console.log(ages)//Result: [10]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment