题解 | #判断是否包含数字#

判断是否包含数字

https://www.nowcoder.com/practice/0fcb4eb9306d4bec837d0037fe39bcf7

function containsNumber(str) {
    const reg = /\d/g
    return reg.test(str)
}

知识点 正则的基础 test() 方法 match()

function containsNumber(str) {
    return str.match(/\d/) ? true : false;
}

#S71#
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务