What actually is Computed Property names? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What actually is Computed Property names?

Hello! I want to know details about Computed property names and in what type of application we can use this thing?

19th Nov 2020, 8:52 AM
Dhruv Kohli
Dhruv Kohli - avatar
2 Answers
+ 3
Oh. Okay. Computed property names are usually enclosed in square brackets. var obj = { ['a'.repeat(5)]: 'hello' } It will be referenced like this: obj.aaaaa // hello Or obj['aaaaa'] // hello Or obj['a'.repeat(5)] // hello
19th Nov 2020, 10:58 AM
Ore
Ore - avatar
0
No! I am asking in JavaScript
19th Nov 2020, 10:30 AM
Dhruv Kohli
Dhruv Kohli - avatar