Array.prototype.includes = function(value) {
var self = this
for (var i = 0 i < this.length i++) {
if (self[i] === value) {
return true
} else {
return false
}
}
}
}
[1,2,3,4,65,67,89,4].includes(67)
// true
[1,2,3,4,65,67,89,4].includes(88)
// false
将字符串"teacher,student,name,age,wangming,liming,xiaohong"赋给一个字符串变量,然后用函数split以,为分隔符把该字符串中的各个单词分开不就行了吗?