+ 1
Function can't make changes in the object??
I wrote the following code in which ad() changes the value of tyer in the given obj. But the value is always returned nan and the object remains the same. https://code.sololearn.com/Wxa8Nx4W0gu5/?ref=app
2 Respostas
+ 1
Use function instead of an arrow function. An arrow function is not bind to this (I can't explain clearly because I'm new to JS, sorry 🙄).
ad : function() {
// your code
}
+ 1
That finally worked😲😄😄 thanks a lot. I'am really intrigued to know the reason behind this.