question | SoloLearn: Learn to code for FREE!



[]==new Array() ,{}==new Object() ,function(){}== new Function Can anybody explain this or provide any sources. It would be helpful to me.

2/20/2019 2:18:58 PM

Ozair Khan

2 Answers

New Answer


on the left side you have the shorthand notations and on the right side you have the "long" notations. Create a new Array: var arr1 = []; //creates an empty Array var arr2 = new Array(); //also creates an empty Array Create an Object: var obj1 = {}; //creates a new Object without any properties var obj2 = new Object(); //same as above Create a Function: var func1(){}; creates a new function without parameters that does nothing. var func2 = new Function()


Thanks. Very useful👍