Possible mistake in the quiz - Full Stack Curriculum

Hey

I may have encountered a mistake in of the quizes in this lecture. In the 3rd question (“Which of these is one of the correct ways JavaScript handles arrays when converting them to numbers using the Number constructor?”) in my opinion there are 2 correct answers:

  1. An array with a single number converts to that number, while an empty array returns 0.
  2. An array with string(s) converts to NaN.

and only option number 1 passes.

https://www.freecodecamp.org/learn/full-stack-developer/lecture-working-with-types-and-objects/what-is-the-number-constructor-and-how-does-it-work-for-type-coercion

it is not always true
consider the array ["6"]. what does this do?

image

2 Likes

Ah, okay that makes sense.

But then shouldn’t this part of the lecture be slightly different?

“When working with arrays there are a few things to consider.

An empty array will return 0. An array with a single number will return that number. An array with multiple numbers returns NaN. And an array with string(s) will also return NaN.

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

1 Like