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 Foundations Arrays Creating Arrays

John Grillo
John Grillo
30,241 Points

Why is new Array() capitalized? is 'new array()' ok? The later won't pass the quiz

I just took the javascript quiz on arrays and discoved that var guides

won't pass if it's set to the lower one but ill pass if it is the first one. Is there any reason for this?

var guides = new Array(42); var guides = new array(42);

2 Answers

new Array (42) is JavaScript's built-in array constructor and Creates an array with 42 undefined elements.

Jeff Jacobson-Swartfager
Jeff Jacobson-Swartfager
15,419 Points

JavaScript is case sensitive (to JavaScript, JohnGrillo is different from johnGrillo). Similarly, the Array() is different from the array() function. Array() is a global object. You can find out more about it on MDN.