数组的indexOf 和字符串的indexOf 不一样

数组是指定元素,意思就是说一摸一样才行     字符串包含就行

let arr=['10','2'];
        let bol=arr.indexOf('1');
        let bol1=arr.indexOf('10');
        console.log('bol',bol);//-1
        console.log('bol1',bol1);//0

猜你喜欢

转载自blog.csdn.net/github_39319000/article/details/89567871