Dojo.Indexof lookup value in the array

dojo.indexOf The function can find out the position of a specific value in an array.

Try to find the valuename The address of the array:

var list=[“name”,”age”]

console.log(dojo.indexOf(list, " name")); .

index What is returned is the subscript of the first position. Therefore, if there are multiple items in the array with the same value, it will only stop at the first item. Dojo provides a similar function, dojo.lastIndexOf allows you to find the last position of a specific value. This function is the same as dojo.indexOf runs in exactly the same way.

Leave a Comment

Your email address will not be published.