Sum All Numbers in a Range cannot use let or es6?

Sum All Numbers in a Range cannot use let or es6?


Hello all,

I just ran into a weird issue about the keyword let being rejected due to it being a part of es6. I did some googling and found this post on S/O

suggesting to add the following comment to my code to fix it.
/*jshint esversion: 6 */

So I get that it works. But I don’t get why it works. Does anyone know?

Your code so far

function sumAll(arr) {
  let total = 0;
  let smallest = Math.min(arr[0],arr[1]);
  let largest = Math.max(arr[0],arr[1]);
  let totalArr = [];
  while(smallest <= largest){
  // total = totalArr.reduce(function(first,next){
  //     return first+next;
  // });
  return total;
sumAll([1, 4]);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36.

Link to the challenge:


FCC used jshint (which is a linter) to check for syntax errors in your code. Unless you tell it that your code is ES6, let and the other ES6 features are unknown to it and sees them as errors thus not letting you pass the challenge.


hmmm and apparently JSHint allows comments to be interpreted as implicit commands. I’m curious now to look more into linters for js. Thank you for the reply.


There are various ways to configure it. One of them is inline configuration. When the linter parses the code, it interprets comments starting with jshint as commands.

There is more info here (Inline Configuration is the relevant part)