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.