re: 10 Challenging JavaScript Quiz Questions and Answers VIEW POST


Nice quiz. I enjoyed it more than other JS quizzes I have seen.
In Question 2 though, since it is about performance, it might be useful to know that a var declaration in a for loop is more performant than a let declaration. As long as your for loop is scoped to a function, you should not get any nasty surprises.

An example could be:

function each (f, array) {
  for (var i = 0, max = array.length; i < max; ++i) {
    f(array[i], i);
Code of Conduct Report abuse