daily pastebin goal
21%
SHARE
TWEET

Untitled

a guest Feb 14th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <meta charset="utf-8">
  5.   <meta name="viewport" content="width=device-width">
  6.   <title>Filter() object Option - 2</title>
  7. </head>
  8. <body>
  9.  
  10.  
  11. <script id="jsbin-javascript">
  12. //Splice()
  13.  
  14. var myArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  15.  
  16. function isEven(value, index, array){
  17.  
  18.   if (value % 2 == 0)
  19.   {
  20.   return true;  
  21.   }
  22.   else{
  23.     return false;
  24.   }
  25.  
  26.   //return value % 2 == 0;
  27. }
  28.  
  29. var result = myArray.filter(isEven);
  30.  
  31. document.write(result);
  32. </script>
  33.  
  34.  
  35.  
  36. <script id="jsbin-source-javascript" type="text/javascript">//Splice()
  37.  
  38. var myArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  39.  
  40. function isEven(value, index, array){
  41.  
  42.   if (value % 2 == 0)
  43.   {
  44.   return true;  
  45.   }
  46.   else{
  47.     return false;
  48.   }
  49.  
  50.   //return value % 2 == 0;
  51. }
  52.  
  53. var result = myArray.filter(isEven);
  54.  
  55. document.write(result);
  56. </script></body>
  57. </html>
RAW Paste Data
Top