js字符串和整型
文章描述:
js整型与字符串转换
let a = '1'
console.log(a)
let b = 2
console.log(b)
let c = [a,b]
console.log(c)
结果:
1
2
[‘1’, 2]
字符串
数字转字符串
b = b.toString()
[‘1’, ‘2’]
整型
字符串转整型
a = parseInt(a)
[1, 2]
发布时间:2023/08/06
文章描述:
js整型与字符串转换
let a = '1'
console.log(a)
let b = 2
console.log(b)
let c = [a,b]
console.log(c)
结果:
1
2
[‘1’, 2]
数字转字符串
b = b.toString()
[‘1’, ‘2’]
字符串转整型
a = parseInt(a)
[1, 2]
发表评论