I am currently finding it hard to figure out the difference between an object literal and a class.
Asked
Active
Viewed 450 times
0
-
2To start things, an object literal is not a function. Please refer to a tutorial, or give a more specific point, where you are confused. – ASDFGerte Nov 25 '19 at 09:37
-
2One is `{name: "hello"}` the other `class Person() {}; new Person()` – VLAZ Nov 25 '19 at 09:37
-
2If you need multiple instances of your object (ie: you have more than one version of that object), then a class is probably the way you need to go, if you have only need one instance, then you could probably use an object literal (using a class still wouldn't hurt though) – Nick Parsons Nov 25 '19 at 09:39
-
just search your question on google, you'll get thousand of article and videos! – Ericgit Nov 25 '19 at 09:43
-
feeling bit hopeful@NickParsons – subhashchandru Nov 25 '19 at 09:45
1 Answers
2
Here's a link!
This might be helpful for you.
Content of the link:
The most significant difference I can see between creating classes and literally notated objects is that the latter are entire objects, whereas classes are not objects, but blueprints from which objects are created.