Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javascript/FreeCodeCamps/Basic JavaScript/Iterate Odd Numbers With a For Loop.md #1

Open
fasatrix opened this issue Jun 16, 2018 · 0 comments

Comments

@fasatrix
Copy link

fasatrix commented Jun 16, 2018

I would simply write something like the following( i%2 returns true for odd numbers):

// Setup
var myArray = [];
for (var i=1; i<10; i++) {
  if (i%2) {  
    myArray.push(i) 
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant