Transcript from the "new" Lesson
>> Kyle Simpson: Now there are built in fundamental objects that we wanna look at. And many of these are ones that actually come historically, they were kinda copied from a language like Java. And that's why they all have capital letters like capital O Object and capital A Array and F Function.
[00:00:36] But we have some other fundamental objects that we don't want to use the new keyword. Specifically string number and boolean, those we want to use those as functions. We don't wanna put the new keyword in front of them. Because if we call string or number or boolean with some value, it actually changes it into that type.
[00:00:54] And in just a little bit, we're gonna be talking about changing the types of our values if we have a string and we want to make it into a number or vice versa. So those three turned out to be really useful in what we're gonna call type conversion, conversion of a type.
[00:01:10] Here's an example of using the new in front of one of those constructor forms of a fundamental object. Saying new capital D Date, that's how we can make a date object and then use something like the toUTCString method to represent this long form of that date and time of that object.
[00:01:29] But then you will notice on line 5 I'm using capital S String as a function to convert something that is a number like my college GPA, and yes that's actually is the GPA that I graduated with from college. Then that, you can take your numeric form of the GPA and turn into a string, that's why in the comments on line six, it's actually got quotes around it because now it's a string.
[00:01:53] So using new in front of the fundamental objects where we wanna make object representations and skipping the new keyword whenever we wanna call it to do a type conversion, like we're doing on my font.