0
   

Noob needs some help

 
 
Reply Mon 20 Jul, 2015 06:06 pm
//write a function below called “oddsAndEvens” that loops through a //parameter “num” (an array), for each number in the given array, if it is even, it is added to the evens array, if the number is odd, it is added to the odds array.

//this is what i think

function oddsAndEvens(nums) {
for (var i = 0; i < nums.length; i++) {
if (nums % 2 === 0) {
evens.push(nums)
} else {
odds.push(nums)
}
}
}


would you change this at all ?
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 1,754 • Replies: 0
No top replies

 
 

Related Topics

Clone of Micosoft Office - Question by Advocate
Do You Turn Off Your Computer at Night? - Discussion by Phoenix32890
The "Death" of the Computer Mouse - Discussion by Phoenix32890
Windows 10... - Discussion by Region Philbis
Surface Pro 3: What do you think? - Question by neologist
Windows 8 tips thread - Discussion by Wilso
GOOGLE CHROME - Question by Setanta
.Net and Firefox... - Discussion by gungasnake
Hacking a computer and remote access - Discussion by trying2learn
 
  1. Forums
  2. » Noob needs some help
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 11/08/2024 at 08:39:50