-
Notifications
You must be signed in to change notification settings - Fork 29
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
homework js-basics completed #23
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks good--it's clear that you're building logically using code we've used before, and that's a good process to use.
let toStop = false; | ||
|
||
while (!toStop) { | ||
toStop = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it's very much based on the sorting code from yesterday, and the outer loop isn't necessary; it will only ever run once. So if you got rid of lines 28, 29, 30, 31, and 43, your code would run in exactly the same way.
var p =[]; | ||
function primes(max) { | ||
for (var i = 2; i < max ; i++) { | ||
if (isPrime(i) === true){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anytime you're checking if something === true
, you can just check that thing! You could just say if(isPrime(i))
.
if (num % i === 0){ | ||
return false | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Watch your indentation here; it'll be easier to debug your code when it's easier to read.
|
||
var new_words = [randomItemFirst, randomItemSecond, randomItemThird]; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish that this had gotten to the stage of putting those words into the sentence together, but this is a good start!
I completed this assignment with extra couple hours. Googled and asked friends' assistance. I will put more time to view it again. Thanks