difference between object and Object in javascript

object  is a datatype which strore key value pair

Object  is a constructor function

console.log(object)

// Error: object is not defined

console.log(Object)


// function Object()


const object1 = new Object();

object1.property1 = 42;

console.log(Object()); //object {} // empty function


typeof(Object); //'function'


var obj1={};

typeof(obj1);  // 'object'

Comments

Popular posts from this blog

Two Sum II - Input Array Is Sorted

Comparable Vs. Comparator in Java

Increasing Triplet Subsequence