woodPeckerAnos
Results
comments of
woodPeckerAnos
ES6本身提供了String实例的repeat方法,如果还要手写,一般是考虑兼容性问题,得用旧的语法 ``` function repeat (str, times) { if (typeof String.prototype.repeat === 'function') { return str.repeat(times) } else { var arr = new Array(times) for (var i = 0; i <...
/* 添加了一个随机字母大小写的功能 */ function randomCase (str) { if (typeof str !== 'string') { throw new TypeError('需要传入一个字符串') } const tempArr = [] for (let w of str) { if (/\D/.test(w) &&...