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, 禁止转载
标签:js,解构,数组,year,默认值,day From: https://www.cnblogs.com/anonymous-ufo/p/16937291.html