-1

I was asked this in an interview. I couldn't answer. Not sure if it was a trick question.

let a = {}

and

let a = new Object

Neon
  • 490
  • 2
  • 9
  • 2
    Possible duplicate -- [What is the difference between \`new Object()\` and object literal notation?](https://stackoverflow.com/questions/4597926/what-is-the-difference-between-new-object-and-object-literal-notation) – JoshG May 21 '21 at 17:34
  • Refer this https://stackoverflow.com/a/5513376/2617344 – Anup May 21 '21 at 17:34

1 Answers1

0
new Object()

has a default argument value of {}

You can also initialize an Array with new Object

const a = new Object([]);

See here.

OGordo
  • 143
  • 1
  • 6