JavaScript Type Conversion and Coercion Quiz

Topics: Type conversion and Type coercion

JavaScript Quiz #05 - Type Conversion and Coercion

5 mins read

1. What is the output?

 const a = 3;
const b = "5";
console.log(a + b);

2. What is the output?

 const x = "10" - 2;
console.log(x);

3. What is the output?

 const a = true;
const b = 2;
console.log(a + b);

4. What is the output?

const x = "20" * 4;
console.log(x);

5. What is the output?

 const a = null;
const b = 5;
console.log(a + b);

6. What is the output?

 const a = "Hello";
const b = " World";
console.log(a - b);

7. What is the output?

 const a = 0;
const b = false;
console.log(a == b);

8. What is the output?

 const x = null == undefined;
console.log(x);

9. What is the output?

 const x = [] == "";
console.log(x);

10. What is the output?

 const x = "0" === 0;
console.log(x);