【笔记】为小于10的月份加0

    技术2022-07-11  86

    let month=[1,2,3,4,5,6,7,8,9,10,11,12]; console.log(month); //[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] let newMonth = month.map(item=>('0'+item).substr(-2)); //全部加‘0’,截取倒数两位 console.log(newMonth) //["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
    Processed: 0.011, SQL: 9