将字符串(M123 p100.1 q200.2)写入数组,如何从数组中读出浮点数?
const test = ['M123', 'p100.1', 'q200.2'].map(cur => { return cur.match(/\d+.\d+/)[0] }) console.log(test) //["123", "100.1", "200.2"]
你想要的是这个意思吗,如果对你有帮助的话,希望能给我一个采纳呀,万分感谢!