通用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);

 

posted @ 2020-11-10 18:47  橘雎  阅读(102)  评论(0编辑  收藏  举报