Costinu’s Blog

When you dream, there are no rules. People can fly; anything can happen. Sometimes, there’s a moment as you’re waking, and you become aware of the real world around you; but you’re still dreaming. You may think you can fly, but you better not try.
Oct 5
JavaScript:
  1. /**
  2. *functin implementing PHP's in_array() function
  3. *@param: array - search array
  4. *@param: search_term - element to be searched
  5. *@return: true/false
  6. */
  7. function in_array (array, search_term) {
  8. if (array) { //see if array exists
  9. var i = array.length;
  10. if (i> 0) {
  11. do {
  12. if (array[i] === search_term) {
  13. return true;
  14. }
  15. } while (i--);
  16. }
  17. return false;
  18. } else {
  19. return false;
  20. }
  21. }

Bookmark and Share:

Nici un comentariu. »

Nici un comentariu până acum.

Feed RSS pentru acest articol. TrackBack URI

Adaugă un comentariu


Comments links could be nofollow free.