我想输出101 就是输出数字部分 这个要怎么写
我知道可以写成
Document·write(parseInt(“101中学
”));
我想要str 变量名称代替 就不知道怎么写
Number(“123”)
语法错误,拼写错误
var str ="101中学"
document.write(parseInt(str))
var str ="101中学"
document.write(parseInt(str.slice(0, 3)))
var str ="101中学"
console.log(parseInt(str.substr(0,3)));
var str = "101中学"
document.write(parseInt(str))
const reg = /(\d{1,3})+(?:\.\d+)?/g;
const str = '101中学';
console.log(str.match(reg).map(Number));