- Array.prototype.some()
arr.some(callback[, thisArg])
测试数组中的某些元素是否通过了指定函数的测试
some为数组中的每一个元素执行一次 callback函数,直到找到一个使得 callback 返回一个“真值”(即可转换为布尔值 true 的值)。如果找到了这样一个值,some将会立即返回 true。否则,some返回 false。callback只会在那些”有值“的索引上被调用,不会在那些被删除或从来未被赋值的索引上调用。
- String.prototype.trim()
str.trim();
trim()删除一个字符串两端的空白字符。在这个字符串里的空格包括所有的空格字符 (space, tab, no-break space 等)以及所有的行结束符
trim()并不影响原字符串本身,它返回的是一个新的字符串。