Tuesday, March 11, 2014

Array.Indexof is used to find the occurence of an element in an Array

Array.IndexOf is used to find the occurence of an elment in an array. i.e it picks out the index where this element is appearing in the array.

Example :

var hobbies= ["Walking", "Shotting", "Riding", "Cricket"];
var a = fruits.indexOf("Cricket");


a holds the value of 3 . Because the index where Cricket present is 3.

No comments:

Post a Comment