ES6學習記錄——解構賦值

ES6 容許按照必定模式,從數組和對象中提取值,對變量進行賦值,這被稱爲解構javascript let [head, ...tail] = [1, 2, 3, 4]; head // 1 tail // [2, 3, 4] let [x, y, ...z] = ['a']; x // "a" y // undefined z // []let [head, ...tail] = [1, 2,
相關文章
相關標籤/搜索