Home » Javascript » Types of objects in javaScript

Types of objects in javaScript

Posted by: admin August 19, 2018 Leave a comment


I have a few objects (a,b,c,..i) in js created as shown below

var a = {x:1};
var b = function(y){this.x = y};
var c = new Object({x:1});
var d = new b(1);
var e = b(1);
var f = (y) => {return {x:y};};
var g = new f(1); // error
var h = f(1);
var i = new a();//error

Kindly explain what is the deference in these objects?
why some are invalid?
I’m expecting an advanced explanation connected to prototypes in js.