Skip to content

Instantly share code, notes, and snippets.

@jimode
Last active August 31, 2018 23:11
Show Gist options
  • Save jimode/6d0fe12a61789e4a23a4b0d30b5ce7fb to your computer and use it in GitHub Desktop.
Save jimode/6d0fe12a61789e4a23a4b0d30b5ce7fb to your computer and use it in GitHub Desktop.
Shorthand for creating object literals - JS Bin// source https://jsbin.com/siqocem
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
"use strict";
var calories = 600;
var meal = { calories: calories };
console.log(meal);
</script>
<script id="jsbin-source-javascript" type="text/javascript">const calories = 600;
const meal = { calories };
console.log(meal);</script></body>
</html>
"use strict";
var calories = 600;
var meal = { calories: calories };
console.log(meal); // { calories: 600 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment