通用api整理

repeat()

includes()

var str = "abc"
console.log(str.includes("a"))
//true
console.log(str.repeat(3));
//abcabc
console.log(str.repeat())

startsWith()  endsWith()

var str = "abc"
console.log(str.startsWith("a"));
console.log(str.endsWith("c"));

set去重

let list = [2, 2, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 0]
let newList = new Set(list)
console.log(newList);
原文地址:https://www.cnblogs.com/bigbang66/p/13955369.html