Ngu*_*hựt 6 javascript include
some :如果找到函数返回真值的数组元素, some() 返回真(并且不检查剩余值)。包括:对于所有元素都返回。
不知道对不对?。何时使用 some 或 includes ?。谢谢大家。
小智 21
some 接受一个回调函数,您可以在其中编写自己的逻辑来确定数组是否包含与您编写的条件匹配的某些元素。
includes does a generic equalTo comparison on every element and will return true if at least one element in the array is equal to the value to find.