Beyond the improved readability, is there any advantage to includes
over indexOf
? They seem identical to me.
What is the difference between this
var x = [1,2,3].indexOf(1) > -1; //true
And this?
var y = [1,2,3].includes(1); //true
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…