2017-02-28 00:54:18 +08:00
|
|
|
/**
|
2018-05-25 00:38:52 +08:00
|
|
|
*
|
2017-02-28 00:54:18 +08:00
|
|
|
* @authors yutent (yutent@doui.cc)
|
|
|
|
* @date 2017-02-27 21:56:03
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-05-25 00:38:52 +08:00
|
|
|
'use strict'
|
2017-02-28 00:54:18 +08:00
|
|
|
|
|
|
|
// 判断数组是否包含指定元素
|
2018-05-25 00:38:52 +08:00
|
|
|
if (!Array.prototype.includes) {
|
|
|
|
Object.defineProperty(Array.prototype, 'includes', {
|
|
|
|
value: function(val) {
|
|
|
|
for (let it of this) {
|
|
|
|
if (it === val) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
},
|
|
|
|
enumerable: false,
|
|
|
|
writable: true
|
|
|
|
})
|
2017-02-28 00:54:18 +08:00
|
|
|
}
|