+ 2

Help me understand JavaScript new keyword

I am currently at this part of the course: https://www.sololearn.com/Play/JavaScript I don't really understand it, I did search in google but I'm still a beginner at JavaScript and all the sites I visited go over many details about stuff I don't yet understand, can I have a simple explanation? Should I just ignore it for now and continue with the course? For Arrays I don't really see any difference when I remove the new keyword, object constructors however for some reason do not work without it.

20th Sep 2020, 3:05 PM
Karak10
Karak10 - avatar
3 Respostas
+ 1
The `new` keyword creates a new object through prototypical inheritance from a constructor function object. I created this short code to illustrate this concept https://code.sololearn.com/Wi7Ui1PnAUMo/ PS: That link you shared points me to the play section of the app.
21st Sep 2020, 5:04 AM
Ore
Ore - avatar
0
Karak10 the new operator creates a new instance of an object(i.e object constructors). Check out www.javascript.info for some cool tutorials
27th Sep 2020, 6:07 AM
Infinite
Infinite - avatar