search

Home  >  Q&A  >  body text

Please tell me a question related to closures in javascript

I have a question. In this js code, I change the value of dimensions. In the first function, I can see the change in the value of dimensions. However, in the second function, the value remains unchanged and is still the same as before. Okay, how to solve this problem?

Thanks!

为情所困为情所困2792 days ago396

reply all(1)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-19 10:47:32

    Dear, I think this is caused by () => this of the arrow function. You can try replacing the arrow function with function

    reply
    0
  • Cancelreply