• Increase font size
  • Default font size
  • Decrease font size

Array.indexOf does not work in Internet Explorer

While trying to do an indexOf on a Javascript array I discovered that it wouldn't work in Internet Explorer!

IE does not support this method for array's! So A quick search on the web lead me to soledad penedés web site where I discovered a simple solution. All you have to do is add the following chunk of code to your script with no modifications and it will force Internet Explorer to function properly! How cool is that!

<code title="Array.indexOf() JavaScript">if(!Array.indexOf){
 Array.prototype.indexOf = function(obj){
 for(var i=0; i<this.length; i++){
 if(this[i]==obj){
 return i;
 }
 }
 return -1;
 }
}</code>

 

Comments  

 
0 #30 WilliamsDiacy 2020-02-24 09:01
massachusetts rehab centers best alcohol detox centers free rehabs in indiana
Quote
 
 
0 #29 InvisiCharger 2020-02-03 13:17
I'm now not positive where you are getting your info,
however good topic. I needs to spend a while
studying more or working out more. Thank you for magnificent info I
used to be searching for this info for my mission.

Also visit my homepage ... InvisiCharger: http://quangcao.com.au/index.php?qa=user&qa_1=ottosenbroussard4
Quote
 
 
0 #28 Quiet Buds Review 2020-02-03 12:27
It's going to be finish of mine day, however before finish I am reading this
great post to improve my know-how.

Feel free to visit my web blog; Quiet Buds Review: http://news.nilu.jns.fi/index.php?a%5B%5D=%3Ca+href%3Dhttp%3A%2F%2Fwww.chiusiaperta.it%2Findex.php%3Ftitle%3DUtente%3AClaritaTasman62%3EQuiet+Buds+Reviews%3C%2Fa%3E
Quote
 
 
0 #27 Brittny 2020-02-03 07:31
Appreciate this post. Let me try it out.

Here is my webpage :: Activ8 Fitness Tracker Reviews (Brittny: http://lisdg.com/jugspace/members/svanebagger2/activity/14302/)
Quote
 
 
0 #26 InvisiCharger 2020-02-03 02:25
Howdy! Someone in my Facebook group shared this site with us so I
came to give it a look. I'm definitely enjoying the information. I'm
book-marking and will be tweeting this to my followers!
Terrific blog and brilliant design.

Here is my webpage - InvisiCharger: http://o.ch/phpinfo.php?a%5B%5D=%3Ca+href%3Dhttp%3A%2F%2Fislam-pedia.de%2Findex.php%3Ftitle%3DAre_You_Embarrassed_By_Your_InvisiCharger_Skills_Here%25E2%2580%2599s_What_To_Do%3EInvisiCharger+Reviews%3C%2Fa%3E
Quote
 
 
0 #25 DroneX Pro 2020-02-02 16:30
My brother suggested I would possibly like this blog. He was totally
right. This put up actually made my day. You can not consider just how
so much time I had spent for this info! Thanks!

Here is my webpage - DroneX
Pro: http://.nu.ac.th/index.php?a%5B%5D=DroneX+Pro+Review%2C+%3Ca+href%3Dhttps%3A%2F%2Fwww.cs.odu.edu%2F%7Emln%2Fteaching%2Fcs595-s12%2F%3Fmethod%3Ddisplay%26redirect%3Dhttps%3A%2F%2Fwww.smore.com%2Fk8df1-dronex-pro-review-facts-discount%3Eread+this+blog+post+from+Cs+Odu%3C%2Fa%3E%2C
Quote
 
 
0 #24 DroneX Pro Review 2020-02-01 18:27
My family members every time say that I am wasting my time here
at net, but I know I am getting know-how all the
time by reading such pleasant articles.

my blog ... DroneX Pro Review: http://freekr1.nayana.kr/mysql/ver.php?a%5B%5D=%3Ca+href%3Dhttp%3A%2F%2Fwww.surferswiki.com%2Findex.php%3Ftitle%3DHow_To_Restore_DroneX_Pro%3EDroneX+Pro+Review%3C%2Fa%3E
Quote
 
 
0 #23 Quiet Buds Review 2020-01-26 09:31
What's up all, here every person is sharing these kinds
of know-how, so it's pleasant to read this website, and I used to pay
a visit this webpage everyday.

Here is my web site :: Quiet Buds Review: http://18.188.87.57/index.php?qa=117522&qa_1=seven-ways-facebook-destroyed-quiet-buds-without-noticing
Quote
 
 
0 #22 SleepNow Reviews 2020-01-26 07:45
Hello There. I found your blog using msn. This is a very well written article.
I'll be sure to bookmark it and come back to read more of your useful information. Thanks for the
post. I will certainly return.

Feel free to visit my blog SleepNow Reviews: https://www.pingofive.com/user/profile/13580
Quote
 
 
0 #21 SleepNow Review 2020-01-26 05:58
Everything is very open with a precise explanation of the challenges.

It was definitely informative. Your site is very helpful.
Many thanks for sharing!

My web site - SleepNow Review: http://socialmediainuk.com/story4892726/sleepnow-sleepnow-reviews-sleepnow-review
Quote
 

Add comment

No bad words.


Security code
Refresh


Design by i-cons.ch / etosha-namibia.ch