var k_as_v = "k_as_v";
obj = {
[k_as_v]:k_as_v,
}
console.log(obj);
Why cant I just keep k_as_v
var k_as_v ="k_as_v";
obj = {
[k_as_v],
}
console.log(obj);
If cant how can i achieve this without re-declaring, any hack !
var k_as_v = "k_as_v";
obj = {
[k_as_v]:k_as_v,
}
console.log(obj);
Why cant I just keep k_as_v
var k_as_v ="k_as_v";
obj = {
[k_as_v],
}
console.log(obj);
If cant how can i achieve this without re-declaring, any hack !
For further actions, you may consider blocking this person and/or reporting abuse
Ashish Khare😎 -
Johansson Bruun -
Crowder Boel -
Kanstrup Sharma -
Top comments (4)
Just remove the square brackets.
{ kasv }
No mate , not working
jsbin.com/nuboloqaqi/edit?js,console
One set of curly brackets too many.
Obj = { kasv }
Thank you, Done !