0

I am currently finding it hard to figure out the difference between an object literal and a class.

Rob Kwasowski
  • 2,690
  • 3
  • 13
  • 32
subhashchandru
  • 97
  • 1
  • 10
  • 2
    To 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
  • 2
    One is `{name: "hello"}` the other `class Person() {}; new Person()` – VLAZ Nov 25 '19 at 09:37
  • 2
    If 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 Answers1

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.

adiga
  • 34,372
  • 9
  • 61
  • 83
AllwiN
  • 693
  • 2
  • 12
  • 26