How do I parse a string to number while destructuring?

前端 未结 8 1051
[愿得一人]
[愿得一人] 2020-12-05 10:23

I am trying to experiment around destructuring assignment. Now I have a case which I trying to cop up with destructuring itself.

For example, I have an input like th

8条回答
  •  醉梦人生
    2020-12-05 10:47

    It's not possible - no operations can be performed on a property during destructuring. If you use destructuring to extract a property into a variable, that variable will be === to the original property value.

    (of course, you could transform the original object's values to Number prior to destructuring, but that's not the same thing)

提交回复
热议问题