We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/** 18、capitalize:字符串首位大写 */ function capitalize(str){ return str.charAt(0).toUpperCase() + str.slice(1) } capitalize('aA') capitalize(null) capitalize(undefined) capitalize(NaN)
....需要优化强大
The text was updated successfully, but these errors were encountered:
/* 16、camelize:横线转驼峰命名 * */ let camelizeRE = /-(\w)/g; function camelize(str) { return str.replace(camelizeRE, function(_, c) { return c ? c.toUpperCase() : ''; }) }
1.库最好不要有私有变量 2.return c ? c.toUpperCase() : ''; 这里不需要判断,直接return c.toUpperCase()
Sorry, something went wrong.
/* 45、arr.findIndex:返回数组中通过测试(函数fn内判断)的第一个元素的下标 * */ Array.prototype.findIndex = Array.prototype.findIndex || function findIndex(fn, ctx){ fn = fn.bind(ctx) let result; this.some((value, index, arr) => { return fn(value, index, arr) ? (result = index, true) : false }) return result }
这里就很矛盾了:都可以使用Array.some怎么就不支持Array.findIndex呢?还支持ES6箭头函数的浏览器也会缺少findIndex支持?
No branches or pull requests
....需要优化强大
The text was updated successfully, but these errors were encountered: