This course has been updated! We now recommend you take the JavaScript: From First Steps to Professional course.

Check out a free preview of the full JavaScript: From Fundamentals to Functional JS, v2 course:
The "Arrays" Lesson is part of the full, JavaScript: From Fundamentals to Functional JS, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Like objects, Bianca shows that arrays are a data structure. Fundamentally, arrays are an object. However, they are commonly used for ordered data like lists.

Get Unlimited Access Now

Transcript from the "Arrays" Lesson

[00:00:00]
>> Bianca Gandolfo: Mrs. White was an array this whole time? How is that possible? Any idea? What is who gonna be if Mrs. White is really an array?
>> Bianca Gandolfo: What's who? Let's see, how about go kart sweater? [LAUGH]
>> Speaker 2: Sorry, what's the question again?
>> Bianca Gandolfo: So you see where it says who ??

[00:00:26]
>> Speaker 2: Yep.
>> Bianca Gandolfo: What do you think that will evaluate to after this code is run?
>> Speaker 2: Mrs. White.
>> Bianca Gandolfo: Yeah.
>> Speaker 2: Yeah.
>> Bianca Gandolfo: Yeah?
>> Bianca Gandolfo: Is anyone suprised by that? Has anyone seen this before?
>> Bianca Gandolfo: Raise your hand if you've seen this before. This looks familiar, a couple people.

[00:01:03]
>> Bianca Gandolfo: I would argue that you have seen this before, cuz we did talk about it earlier with array.push, array.length, right? We have properties on our arrays, yeah? Do you believe me?
>> Bianca Gandolfo: No, yeah, yeah, no, circle.
>> Bianca Gandolfo: Yeah, so arrays are objects and because of that the rules are exactly the same.

[00:01:34] And you may be thinking, but I always see arrays doing something different, there's always a number, there's always some bracket thing, we don't really use dots with arrays, that's weird. What is this crazy lady saying? Well I'm here to tell you that it's all a sham, and the reason that we use brackets is not because it's an array but also, we used brackets with objects.

[00:02:06] So, what do you think this is gonna evaluate here? typeof white === array. Who have I not spoken to yet? Maybe you, Prime sweatshirt.
>> Speaker 3: Sorry, where was White assigned? I don't see a,
>> Bianca Gandolfo: Whoops, sorry, that's supposed to say person.
>> Speaker 3: Sure. I believe that would then respond with the true.

[00:02:38]
>> Bianca Gandolfo: Let's try it.
>> Bianca Gandolfo: I'll have to change that. Can you guys see this all right? Who thinks, so put your thumbs up if you think this is gonna evaluate to true put your thumbs down if you think this is gonna evaluate to false. So we have some thumbs up, we have some thumbs down, be proud.

[00:03:06]
>> Bianca Gandolfo: I like you're like I don't want to show anyone. Moment of truth, false.
>> Speaker 4: Type of object.
>> Speaker 3: Is it an object now?
>> Speaker 4: Yeah.
>> Bianca Gandolfo: So for most of your JavaScript career you're surprised by this because people have been lying to you. And I'm sorry to be the person to tell you, but people have been lying to you, arrays are just objects.

[00:03:42] Yes, they are different a little bit, but not fundamentally. The only difference between an object and an array, is that the arrays have some cool methods on them. Yeah, a method is just a function, right? So when you say array.push, array.pop and this is my symbol for the invocation, call a function, two parentheses.

[00:04:05] Does that translate? I don't know if that translates internationally, and over a screen. But, so those are our methods. And that's really the thing that is different about arrays. Is that length property, which I think is the most important part of the array is the .length property.