Learn JavaScript With Me-V

Type Conversion in JavaScript(JS)

Rahul Kumar Das
2 min readAug 27, 2022

Day -5 of the javascript series & today we’ll be learning about Type Conversion

if you are new to this series check the previous part — (link)

Suppose you are subtracting one variable from another, one variable is an integer type and another one is of double type (A double type can represent fractional as well as whole values). What will you gonna do, to get the correct answer?

The answer is simple you’ll convert one of the variables to another so that you get both of the variables of the same type and solve your problem statement. This is what Type Conversion is about.

Type Conversion is all about converting variables of one type into variables of another type. We do this to make variables compatible with each other.

Types of type conversion in JavaScript(JS)

Implicit Conversion

Automatically converting data types.

Explicit Conversion

Manually converting data types.

Converting to Number -

Converting to String -

Converting to Boolean -

Just play around with it a little more you’ll get more notion about it!!

Extra

Type Conversion is helpful when you want to perform operations on similar kinds of data.

Fun JavaScript Facts

JavaScript took just 10 days to develop.

JavaScript was probably named after Java.

Java is to JavaScript as Gulab to Gulab-Jamun (Both sound the same but are exactly different from each other).

Thanks for reading 🙏🏻😇

Rahul

--

--