Consider the following statements and tell what would be the output of the logs statements?

var price1 = 10;
var price2 = 10;
var price3 = new Number('10'); // A complex numeric object because new was used.
console.log(price1 === price2);
console.log(price1 === price3);

  • : 261
  • : 3
    Previous Next

    console.log(price1 === price2); // Logs true.
    console.log(price1 === price3); /* Logs false because price3
    contains a complex number object and price 1
    is a primitive value. */

    you can suggest other answer in comment box

  • Exam: Java Script Interview QUESTIONS

    Recommended Learning for you

    Subscribe here for free mock test on IAS PCS SSC and other competitive exam. Signup here to get SSC CGL Solution and main exam study material