filmov
tv
JavaScript Primitives vs Objects: Can You Guess the Output? #codechallenge #coding #lessonsjs

Показать описание
Answer: C
new Number() is a built-in function constructor. Although it looks like a number, it's not really a number: it has a bunch of extra features and is an object.
When we use the == operator (Equality operator), it only checks whether it has the same value. They both have the value of 3, so it returns true.
However, when we use the === operator (Strict equality operator), both value and type should be the same. It's not: new Number() is not a number, it's an object. Both return false.
#JavaScript #CodingQuiz #WebDevelopment #Frontend #JSBasics #LearnToCode #Programming #CodeChallenge
new Number() is a built-in function constructor. Although it looks like a number, it's not really a number: it has a bunch of extra features and is an object.
When we use the == operator (Equality operator), it only checks whether it has the same value. They both have the value of 3, so it returns true.
However, when we use the === operator (Strict equality operator), both value and type should be the same. It's not: new Number() is not a number, it's an object. Both return false.
#JavaScript #CodingQuiz #WebDevelopment #Frontend #JSBasics #LearnToCode #Programming #CodeChallenge