function noRepeat(array) {
var temp = []; // 一個(gè)新的臨時(shí)數(shù)組
for (var i = 0; i < array.length; i ++) {
if (temp.indexOf(array[i]) == -1) {
temp.push(array[i])
}
}
return temp
}
var arr = ['a','b','a','c','c','ab','bc'];
console.log(noRepeat(arr))
數(shù)組中找出最大的值
let value = [25, 50, 75, 100]
// es5寫(xiě)法, apply 需要制定 this 綁定
console.log(Math.max.apply(Math, value)) // 100
// es6寫(xiě)法
console.log(Math.max(...value)) // 100