Thread: Help Array!!!!!
View Single Post
Old 12-31-2012, 04:05 PM   PM User | #19
Logic Ali
Regular Coder

 
Logic Ali's Avatar
 
Join Date: Sep 2010
Location: London
Posts: 961
Thanks: 0
Thanked 198 Times in 193 Posts
Logic Ali will become famous soon enoughLogic Ali will become famous soon enough
Quote:
Originally Posted by jmrker View Post
Even better...
Code:
<script type="text/javascript">

array1 = [ 1, 4, 2, 13, 5 ];

odds = array1.filter( function( elem ){ return elem % 2; } )
evens = array1.filter( function( elem ){ return elem%2==0; } )

alert( odds + '\n\n' + evens );

</script>
Now all you need is for Windows XP (IE8) to become 100% extinct, and you'll be able to use it in practice.
Logic Ali is offline   Reply With Quote