Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>Filter() object Option - 2</title>
- </head>
- <body>
- <script id="jsbin-javascript">
- //Splice()
- var myArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
- function isEven(value, index, array){
- if (value % 2 == 0)
- {
- return true;
- }
- else{
- return false;
- }
- //return value % 2 == 0;
- }
- var result = myArray.filter(isEven);
- document.write(result);
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">//Splice()
- var myArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
- function isEven(value, index, array){
- if (value % 2 == 0)
- {
- return true;
- }
- else{
- return false;
- }
- //return value % 2 == 0;
- }
- var result = myArray.filter(isEven);
- document.write(result);
- </script></body>
- </html>
Add Comment
Please, Sign In to add comment