Array vs. Object
Looking at the difference between an array and an object
Video Transcript
00:00We've learned a few basic concepts and started repeating them now and we've seen that our new and
00:05we've seen how we created a new object and now a new array and we're going to see that all of the complex objects all of
00:12the complex data types and
00:14Just to repeat again
00:15What are complex data types as we said complex data types are things that contain more than just a string or more than just a
00:23Boolean basically anything that could have more than one value in it or more accurately
00:27Anything that has more than one value is a complex object now
00:32We met already the basic object and we started that our basic object is basically a bucket and we could put in our bucket
00:38Whatever we want if it's properties or methods or anything else that we need to put into our object our object by default
00:46Oh, so if I just unhighlight it for a second, and I'm just going to type oh and dot just to see the syntax
00:52So you see that we have predefined a few things that we're not getting into right now
00:55But we could see that our object already by default comes already with a few different properties and methods
01:02So even if we put nothing into our object automatically it has some properties and methods which explains why it's the complex object
01:09But the easiest way to explain it is it's a bucket
01:12Versus our previous examples of primitive values. They were in buckets
01:15They were just straight up data if it's a string if it's a number if it's a Boolean
01:20It was always something very basic saying tangible something that only one thing could be in it at any given time
01:26And now we're taking a step above that and we're saying that in our array
01:29Which is an array and it'll reveal a secret which isn't a secret because we've talked about it before is that everything is objects in
01:36Flash, and that's what I'm calling it an array object
01:39Why do I call it an array object because everything is inherited from the object and as we get into object-oriented programming
01:45We're going to really really understand what that means
01:47But basically for just for what we need right now to understand
01:51Is that all the properties that our object had all the default things that our object had our array will have as well
01:58Not only will it have it now our array could add new things and that's actually true
02:03And if you go into the documentation and you check your help you're going to see that on the beginning line
02:08It'll be written their array
02:10Inheritance line and you're going to see an arrow pointing to the object telling you that it's direct parent
02:15It's direct line in the inheritance line is the object
02:19But let's move into our and see what's unique about this array
02:22So as we said arrays compared to objects have one more extra feature that objects do not have objects
02:28Don't really know what came in first what came last and doesn't really care and doesn't even know how many items it has unless we count them
02:35An array by default already knows how many things it has and it keeps tabs of those items
02:40Now that we have an object that keeps tabs of what it has
02:43We have the option of playing around with it
02:45And if we just type a and doubt we're going to see that our array has a lot of different properties and methods
02:51Which we can't really get into all of them in this intro about arrays
02:54Even though we're going to dedicate a whole hour to arrays
02:57We would never be able to cover all these properties in just one lesson
03:01And that's why what I want to do is focus on getting understanding the foundations understanding what arrays are understanding what their usage is
03:09And then later on in a future course
03:12We're going to watch how do we could use them in live action how we could use them in visual programming
