Multiple assignment in javascript? What does [a,b,c] = [1, 2, 3]; mean?

后端 未结 4 1060
遇见更好的自我
遇见更好的自我 2020-11-22 13:32

For a project a developer sent us a .js file with code similar to this:

var myList = [1,2,3];
var a,b,c;

[a,b,c] = myList;

It works in Ope

4条回答
  •  无人及你
    2020-11-22 14:14

    Opera's older "futhark" JavaScript engine had support for this, but it was dropped in the new engine "carakan", because it was non-standard, not required on the web, and would complicate the new and very fast implementation.

提交回复
热议问题