Your technology certification is waiting. Enroll in Cloud Class ®
Array.prototype.indexOf = function (element)
var _len:Number = this.length;
for (var i:Number = 0 ; i < _len ; i++)
if (this[i] == element)
var arr1:Array = new Array(12, 34, 56, 78, 90);
trace(arr1.indexOf(34)); // 1
var arr2:Array = new Array("Action", "Script", "Hello", "World");
trace(arr2.indexOf("Hello")); // 2
trace(arr2.indexOf("world")); // -1
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.