Posted By

Mosaic on 11/18/10


Tagged

javascript array


Versions (?)

[JS] Find key from value


 / Published in: JavaScript
 

/Coded by Alessio Delmonti - www.tecnocrazia.com/

  1. function getKeyStr(j, ar){ //recupera la chiave partendo da il valore di un array
  2. var i;
  3. for(i in ar){
  4. if (j == ar[i]){
  5. return i;
  6. }
  7. else{continue;}
  8. }
  9. }

Report this snippet  

You need to login to post a comment.