I dunno. Good question; I just don't know the answer.
, how is it different from ""Object""? I'm a bit confused by how this resembles Java but not exactly the same. Why is ""Date"" an object but not dateObj2?
When we're invoking methods e.g. dateObj2.getFullYear() , does it mean that we call methods on the variable dateObj2?
Object is like a Java class. In fact it is
exactly like the Object class in Java: it is the ancestor
of all classes. See Java Object Class
The value of dateObj2 is an object. It's a particular date, which is different from the Object class.
The value of Date is a class.
Yes, we can call Date methods on dateObj2
The 1 is the deleteCount: we are deleting one element. See: MDN Array Splice
Yes. toFixed has more features, like choosing a radix.
Good question! No, they aren't. Because in person1[age], age is a variable, while in person1.age is it a literal.
Consider the following code:
Let's play with the JS code in the browser.
When the property you need to access is in a variable instead of known in advance. Here's another example:
Suppose we wanted to add an exclamation point to all the capitals:
Hi!