summaryrefslogtreecommitdiff
path: root/Base/home/anon/js/object-expression.js
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-04-23 19:37:53 +0100
committerAndreas Kling <kling@serenityos.org>2020-04-23 23:56:04 +0200
commit746dd5b190e3d3101bf91da22db2ccd86197b5f2 (patch)
tree20c09b5eecd1e2948f537517a14b1134658b5219 /Base/home/anon/js/object-expression.js
parentbebd5c097c9a5d8e1cfa20d8f1459006c76709e0 (diff)
downloadserenity-746dd5b190e3d3101bf91da22db2ccd86197b5f2.zip
LibJS: Implement computed properties in object expressions
Diffstat (limited to 'Base/home/anon/js/object-expression.js')
-rw-r--r--Base/home/anon/js/object-expression.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/Base/home/anon/js/object-expression.js b/Base/home/anon/js/object-expression.js
index 58449a2c0a..143ece5967 100644
--- a/Base/home/anon/js/object-expression.js
+++ b/Base/home/anon/js/object-expression.js
@@ -1,7 +1,10 @@
const a = 1;
-const object = {a, b: 2};
+const computedKey = "d";
+const object = {a, b: 2, "c": 3, [computedKey]: 2 + 2};
const emptyObject = {};
console.log(object.a);
console.log(object.b);
+console.log(object.c);
+console.log(object.d);
console.log(emptyObject.foo);