js数组方法总结js数组的includes方法
    JavaScript数组的includes()方法用于判断数组中是否包含指定的元素,并返回一个布尔值。
    语法:
    arr.includes(valueToFind[, fromIndex])
    参数:
    valueToFind: 必填,指定要查的元素值。
    fromIndex: 可选,指定开始查的索引位置,默认为0。
    返回值:
    如果数组包含指定的元素,则返回true;如果不包含,则返回false。
    示例:
    var fruits = ["apple", "banana", "orange"];
    console.log(fruits.includes("apple")); // 输出 true
    console.log(fruits.includes("grape")); // 输出 false
    console.log(fruits.includes("banana", 1)); // 输出 false
    在示例中,首先通过fruits.includes("apple")判断数组fruits是否包含"apple",返回true。然后通过fruits.includes("grape")判断数组fruits是否包含"grape",返回false。最后通过fruits.includes("banana", 1)从索引位置1开始查数组fruits是否包含"banana",返回false。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。