In JavaScript. How can I change a field of an object by changing a variable with a reference to that field?
-
I have an object, and I want to change some of its fields by changing another variable. How can this be done? My example code:
var data = { a: 5 } var b = data.a b = 10
JavaScript Anonymous, Mar 5, 2020 -
In no way, assigning something to b, he forgets about the reference to the previous valueAnonymous
1 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!