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

homework js-basics completed #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xianyi555
Copy link

I completed this assignment with extra couple hours. Googled and asked friends' assistance. I will put more time to view it again. Thanks

Copy link

@mnfmnfm mnfmnfm left a 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;
Copy link

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){
Copy link

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
}
};
Copy link

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];


Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants