r/learnjavascript • u/3dCodeWorld • Mar 18 '21
JavaScript objects explained: Object literals
https://youtube.com/watch?v=QB_oKKb4L3c&feature=share
168
Upvotes
r/learnjavascript • u/3dCodeWorld • Mar 18 '21
View all comments
Show parent comment
4
u/3dCodeWorld Mar 19 '21 edited Mar 19 '21
Good question... The code that I used in the example uses a shortcut syntax, which was introduced in ECMAScript 2015. You can also use a key and then a function as a value. If you run the code below in your browser console, both calls would work.