+ 3

How to access the object identifier name dynamically with `this` in it's own properties

```js const Aybak3k = {nickName: this.something} console.log(Aybak3k.nickName // should print "Aybak3k" dynamically !hard coded ```

16th Oct 2021, 1:15 PM
Aybak3k
Aybak3k - avatar
2 Respostas
+ 2
Object value cannot directly return a value, it can only be assigned a value. Use object function to get a return value. Or use getter to get object value dynamically https://code.sololearn.com/cThB1uYRxUIF/?ref=app
17th Oct 2021, 7:41 AM
Calviղ
Calviղ - avatar
+ 1
that's not what i meant i don wanna use a constructor
18th Oct 2021, 8:34 AM
Aybak3k
Aybak3k - avatar