js 字符串转数组,数组解构默认值 All In One
js 字符串转数组,数组解构默认值 All In One
bug ❌
const [year,month,day,title] = [1,2];
year;
// 1
day;
// undefined
solution ✅
const [year = 'a1',month = 'a2',day = 'a3',title = 'a4'] = [1,2];
year;
// 1
day;
// 'a3'
refs
©xgqfrms 2012-2020
www.cnblogs.com/anonymous007 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️anonymous007, 禁止转载 🈲️,侵权必究⚠️!
本文来自博客园,作者:anonymous007,转载请注明原文链接:https://www.cnblogs.com/anonymous-ufo/p/16937291.html