What is flexbox in CSS?

Why is it needed?

  • There are different datatypes in JavaScript, and at times, we might need to perform operations involving these different types of data, so it is very important to know how these data types are coerced from one data type to another. Type coercion is used when various arithmetic and comparison operations are performed on different data types in JavaScript.

What is it?

  • The process of converting values from one data type to another data type, like the conversion of a number data type into a string data type, is called Type Coercion in JavaScript.

How is it used?

Type coercion can be used in 2 manners: implicit and explicit.

  • Implicit type coercion in JavaScript refers to the conversion of values from one data type to another data type without the interference of the developer or the type coercion that happened indirectly. We can do implicit conversion of any primitive datatype to boolean, number or string in JS. For example: "My roll number is: " + 37, will give us "My roll number is 37", the Number 37 will implicitly get coerced into String type due the concatenation (+) sign.
  • Explicit type coercion in JavaScript refers to the conversion of values from one data type to another data type with the interference of the developer or the type coercion that happened directly. We can do implicit conversion of any primitive datatype to boolean, number or string in JS. For example: Number("10") + 10, gives 20 as the number string "10" is coerced to Number 10 by using Number(), without it, we would have got 1010 as the output.
  • How 3 + 2 + “7” \= 57?

First 3 + 2 gives us 5, then this 5 + "7" result in "57" due to implicit type coercion of the Number 5 to String "5" and getting concatenated with the String "7".