![]() JavaScript has dynamically lengthed arrays, closer to a Java vector, just do this:Īnd if you want to loop 100 times, just say index < 100, if an array needs a new slot it makes one. We say that a prime number has exactly 2 factors, which are the number 1 and the number itself. Prime numbers can only be written as 1 × themselves. Prime numbers cannot be made by multiplying other smaller whole numbers. Dont forget: the number 1 is not a prime number as it only has one. The grid above shows the prime numbers to 100. I have the html file set up correctly, but I know I am doing something wrong with the JS. ![]() It creates an array with 100 "undefined" values. It can be divided by 3 as well as 1 and 9. Javascript function that lists prime numbers between 1-100. It does not initialize an array with enough memory set aside for a length of 100. ![]() ![]() This does not do what you think it does in JavaScript. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |