Javascript examples for Array:filter
Check if 10 variables are between 0 and 1
<html lang="en"> <head></head> <body translate="no"> <script> var allScores = [4, 2, 'a', null, null, '7', '']; var errorScores = allScores.filter(function(s) { return !(parseInt(s) >= 0 && parseInt(s) <= 1) });// w ww. j a v a 2 s. c om if (errorScores.length > 0) { document.write('something went wrong!'); } </script> </body> </html>