View Single Post
Old 12-03-2012, 08:02 PM   PM User | #18
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,468
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Note that filter is also much shorter to code and test in the first place as you have only one line of code that you have written that needs testing as compared to the alternative where you have to write a lot more code including a loop.

You can easily implement filter for any of the browsers that do not yet support it by grabbing a copy of the code to add that support from the Mozilla JavaScript reference. You would not need to worry about testing that code any more than you'd need to worry about testing all the code in JQuery (if you use that JavaScript library) as the code has already been tested.


Why code and test an entire loop of code that needs to do the same thing as can already be easily done with only one line of new code.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/

Last edited by felgall; 12-03-2012 at 08:17 PM..
felgall is offline   Reply With Quote