Freecodecamp: "Iterate through an array with a for loop" checks forces you to use "var" cannot use "let" or "const"

Created on 29 Mar 2018  路  10Comments  路  Source: freeCodeCamp/freeCodeCamp

Challenge Name

https://beta.freecodecamp.org/en/challenges/basic-javascript/iterate-through-an-array-with-a-for-loop

Issue Description

The challenge requires you to initialize a variable however it forces you to use var, rather than let or const.

Browser Information

  • Browser Name, Version: Ungoogled Chromium
  • Operating System: macOS
  • Mobile, Desktop, or Tablet: Desktop

Your Code

N/A

Screenshot

screen shot 2018-03-29 at 1 23 37 pm

learn discussing

Most helpful comment

I think I incline towards adding support for let. But it doesn't have to be explicit or obvious, even in the test message. As long as we can keep that I am okay to update the tests.

All 10 comments

It is looking for a specific solution that uses the var keyword.
"tests": [ "assert(code.match(/var.*?total\\s*=\\s*0.*?;/), 'message: <code>total</code> should be declared and initialized to 0');" ]

As a side note, a lot of the beginning javascript challenges force you to use var. I am pretty sure this is by design.

In many other begineer challenges I can use let or const without fail - I don't think users should be overly limited in how they can solve a challenge.

I think I incline towards adding support for let. But it doesn't have to be explicit or obvious, even in the test message. As long as we can keep that I am okay to update the tests.

I think fcc should not only start supporting but also encourage using ES6 already. Furthermore, arrow functions also somehow buggy. I have encountered a problem while solving basic js tasks, where the same function written as an arrow function provides a different result than conventional function declaration. I have tested this on VScode and it was functioning normally.

Anyways too much off topic here. like I said it would be nice if fcc would already encourage using ES6 OR at least have a separate module to for teaching ES6 basics and new syntax.

Hi guys, can i tackle this one?

@sINFmaduft Sure you can take it on.

@Asjas Ok, do i have to mark it somehow?

@Clarke92 Sorry I am not sure what you are talking about? What are you trying to mark?

@sINFmaduft @nsuchy did either of you get around to updating the tests for this challenge to allow for ES6 syntax?

Hi, I have opened a pull request that updates the tests to fix this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ar5had picture ar5had  路  3Comments

MichaelLeeHobbs picture MichaelLeeHobbs  路  3Comments

robwelan picture robwelan  路  3Comments

imhuyqn picture imhuyqn  路  3Comments

QuincyLarson picture QuincyLarson  路  3Comments