You must hand in by using git
bitbucket.org,
gitlab.com, or
github.com,
git push your local repo to the above remote repo.
node_modules/
.gitignore file.
Send a mail to <nmla@iba.dk> with:
handin <subjectname>'
in the subject line of your mail
I will give you a naive example of a function that returns
true if a given number is prime, and
false if it is not.
isPrime
const isPrime = function (arg) {
for (var i = 2; i < arg; i += 1) {
if (arg % i === 0) {
return false;
}
}
return true;
}Your assignment is as follows:
head.
253-1 =
9007199254740991, eg 9007195909437503 :)
Then it must call isPrime with the
entered number as input. The result must be
displayed on the page.
The code must time the function as follows:
let start = new Date();
let b = isPrime(arg);
let stop = new Date();
let elapsed = stop - start;
isPrime in
the branch to a less naive, and
faster version. Test, commit, and correct until it works.
isPrime in
the branch to an even less naive, and
faster version. Test, commit, and correct until it works.
Hand in the repo with all three branches. This means that you
have three working versions of isPrime.