LibJS: Implement computed properties in object expressions

This commit is contained in:
Linus Groh 2020-04-23 19:37:53 +01:00 committed by Andreas Kling
parent bebd5c097c
commit 746dd5b190
Notes: sideshowbarker 2024-07-19 07:20:58 +09:00
5 changed files with 98 additions and 19 deletions

View file

@ -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);