题解 | #判断是否包含数字#
// match()方法在找到匹配项后,返回的是一个数组
// 若未找到匹配项则返回null
function containsNumber(str) {
return str.match(/\d+/g) !== null
}
// match()方法在找到匹配项后,返回的是一个数组
// 若未找到匹配项则返回null
function containsNumber(str) {
return str.match(/\d+/g) !== null
}
相关推荐