Videos
Everything is javascript is an object,
An Array is a type of object, specifically known as an array object.
A string is a type of object, specifically known as a string.
a Binary tree is a type of object, known as just an object.
a heap is a type of object, known as just an object.
The browser interface is a object.
Other APIs using javascript as a scripting language are objects.
https://www.youtube.com/watch?v=MfRkdm_rq5E
A binary tree may not be a native object to Javascript. That just means you need to build the object.
Javascript have objects which can be represented as key-value pair.
The key must be and will be converted to a string. Here is an object
Copy{
name: "Moo", age: 20
}
You can already represent a Binary Tree by using this notation, though not as pretty as C/C++/Java counterpart.
Copy{
node: 20,
left: {
node: 10,
left: null,
right: null
},
right: {
node: 30,
left: null,
right: null
}
}
You can obtain the value of the field using someObject.field or someObject["field"], both are equivalent!.
List and Arrays can be represented using javascript Arrays, however they are also an object. Observe this.
Copyvar myArray = [2,3,5];
myArray[0]; // 2
myArray["0"]; // 2
myArray["push"]; // function push()..... etc etc
Does this means myArray also an object? well yes. It just happened that your browser is smart enough that when you console.log it, it shows the data and hides the methods properly.