Explore 100's Of Free Video Tutorials

Keep Learning, Keep Coding & Keep Sharing

Type Casting - Part 1

Notes:

JavaScript Type Casting : JavaScript Data Conversion
Converting one type of data value to another type is called as type casting.

There are two types of type casting:
Implicit type casting (Coercion): Done by JavaScript Engine
Explicit type casting (Conversion): Done by programmers

Implicit type casting:
If required JavaScript engine automatically converts one type of value to another type.
This is known as implicit type casting.

Ex: document.write(2+ 4.3); // 2.0 +4.3 = 6.3
document.write( “2” + 2); // “2”+”2” = “22”
document.write(2 + “2”); // “2” + “2” = “22”

Interview Questions: