Loops1: https://codepen.io/jiujiu12/pen/yLeYERQ
Loops2: https://codepen.io/jiujiu12/pen/pogjZNm
Loops3:
<https://codepen.io/jiujiu12/pen/WNrQgXw >
Hi @FUR2020, thanks for sending in your code, and welcome to the community!
Your loops1 answer looks fine. The only comment I’d make is that you can just shorten
let textContent = myArray[i] ;
li.textContent =textContent;
to
li.textContent = myArray[i];
Your loops 2 answer also works absolutely fine. Optionally, you could also add an additional if clause that reports that the name is not found in the phone book, if it is not found; see our answer here: learning-area/javascript/building-blocks/tasks/loops/marking.md at main · mdn/learning-area · GitHub
This is not mandatory though‚ just a stretch goal. The question didn’t actually ask for it
your loops3 answer works, but the question is asking you to start at 500, and then count down through the available prime numbers less than 500. You’ve got it the wrong way round.
Very good work here — well done!
Thank you very much! I will improve my code.
It is really helpful for me. @chrisdavidmills