Javascript separate string into different variables

后端 未结 5 1175
清歌不尽
清歌不尽 2020-12-11 13:12

I am looking to take a string and find all the spaces in it and separate that into different variables. I know I could use the .split() but that wouldn\'t make

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-11 13:54

    In addition to the answers the others pointed out, I'd like to point out that Mozilla's JavaScript engine (spidermonkey) supports destructuring assignments:

    
    

    This is not portable, so not ideal for web programming. However, if you're writing a plugin for firefox or thunderbird or etc, then there are a number of interesting language extensions available.

提交回复
热议问题