Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Arrays Store Multiple Values in an Array Create an Array

Benjamin Bonenfant
Benjamin Bonenfant
4,724 Points

why is the following code incorrect for this challenge task? const data = [ '1', '2', '3' ]; Thank you.

script.js
const data = [ '1', '2', '3' ];

Maybe the task want's a changeable array, e.g. var or let

2 Answers

The task asks for three numbers inside the array. The type of the three items within your array are strings.

console.log(typeof '1') // string

Let me know if this helps!

volhaka
volhaka
9,875 Points

The challenge is to include three number values inside the array. Your array includes 3 strings. whatever you put into quotes - ' ' is a string numbers should be without quotes