0

When I initialize some Classes/Interfaces like Node, NodeList, HTMLCollection etc, I get an error: Illegal Constructor

For eg:

var x = new Node();

Uncaught TypeError: Illegal constructor
    at <anonymous>:1:9

var x = new HTMLCollection();

Uncaught TypeError: Illegal constructor
    at <anonymous>:1:9





Question1: Why this error happens ?

Question2: How to initialize such objects?

Question3: Why those Objects are named as Interfaces? Although no such keywords exists in JavaScript

Question4: What else should I know about these kind of Objects/Classes?

I hope, I provided much description to answerers and I also hope to get my answer soon.

  • Possible duplicate of [create a HTMLCollection](https://stackoverflow.com/questions/7754269/create-a-htmlcollection) – ggorlen Jun 22 '19 at 01:41
  • Interfaces are like abstract classes in other OO languages. You can't instantiate them by themselves, you can only instantiate subclasses. – Barmar Jun 22 '19 at 01:52

0 Answers0