Gets the index of an item in the array

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/qq_34664239/article/details/90438548

We all know that obtaining an index, there are two ways, cycling, ES6 the findIndex
intention to see another way today, record it

  • indexOf
var statusArr =  ['applyAgain', 'apply','assign', 'agree', 'refuse', 'doing', 'finish'];
 console.log(statusArr.indexOf('apply'))

However, this approach is only for each of an array of simple data types

Guess you like

Origin blog.csdn.net/qq_34664239/article/details/90438548