编程语言
首页 > 编程语言> > JavaScript 编码技巧

JavaScript 编码技巧

作者:互联网

JavaScript 编码技巧

1. JavaScript 字符串数组转换

const numArray = [1, 2, 3, 4, 5]
const strArray = numArray.map(String)
console.log(strArray) //  ["1", "2", "3", "4", "5"]
数组map语法:array.map(function(currentValue,index,arr), thisValue)

标签:编码,const,技巧,numArray,JavaScript,strArray,map
来源: https://www.cnblogs.com/bore/p/15323049.html