TRY THE DEMO: https://o4qovv4609.codesandbox.io
This
class
calculates all the prime numbers up to a value that is provided by theonChange
event. Every time the user types a character in the input field, all the prime numbers up the current value are being calculatedplease visit
https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
please visit
https://en.wikipedia.org/wiki/Sieve_of_Atkin
- We can measure the performance in ms by using the
performance.now()
method that is independent of the computer's clock.