题解 | #获取指定字符串#
获取指定字符串
http://www.nowcoder.com/practice/4ec56ad04a9a4402a01e50a390a8060a
function captureThreeNumbers(str) { let m = ''; for (let i=0;i<str.length;i++) { let n = str.slice(i,i+3); //isNaN(n)判断n是否不为数字,如果不为数字返回真,为数字返回假 if (!isNaN(n)) { m = n; break; } else { continue; } } return m == '' ? false : m; }