Skip to content

Instantly share code, notes, and snippets.

@shreshthmohan
Created February 9, 2018 11:10
Show Gist options
  • Save shreshthmohan/32164fc0fd247dd22d747f63c4797ca1 to your computer and use it in GitHub Desktop.
Save shreshthmohan/32164fc0fd247dd22d747f63c4797ca1 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/renunoqene
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<h1>Objects in JavaScript</h1>
<script id="jsbin-javascript">
console.log('Objects are simply name-value pairs. A value can itself be a (collection of) name value pair(s).')
console.log('Take a look. See console.');
const obj1 = {
address: {
city: 'Bangalore',
street: '22nd Cross',
apartment: {
floor: '4',
door: '402'
}
}
};
console.log(obj1);
console.log('Aside: Syntax parser. {} is how the syntax parser know we are defining an object. Though there are other ways, like "new Object()", too.');
</script>
<script id="jsbin-source-javascript" type="text/javascript">console.log('Objects are simply name-value pairs. A value can itself be a (collection of) name value pair(s).')
console.log('Take a look. See console.');
const obj1 = {
address: {
city: 'Bangalore',
street: '22nd Cross',
apartment: {
floor: '4',
door: '402'
}
}
};
console.log(obj1);
console.log('Aside: Syntax parser. {} is how the syntax parser know we are defining an object. Though there are other ways, like "new Object()", too.');
</script></body>
</html>
console.log('Objects are simply name-value pairs. A value can itself be a (collection of) name value pair(s).')
console.log('Take a look. See console.');
const obj1 = {
address: {
city: 'Bangalore',
street: '22nd Cross',
apartment: {
floor: '4',
door: '402'
}
}
};
console.log(obj1);
console.log('Aside: Syntax parser. {} is how the syntax parser know we are defining an object. Though there are other ways, like "new Object()", too.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment