ES6 version repeatify
String.prototype.repeatify = String.prototype.repeatify || function (times = 1) {
return [...``.padStart(times, ` `)].map((item, i) => item = this).join(``);
};
`abx`.repeatify(3);
// "abxabxabx"
refs
https://stackoverflow.com/a/62155265/5934465
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!