DEV Community

Avinashd
Avinashd

Posted on

Js in bits - 7(Type Conversions)

Learning js should be fun. It is fun if it's easy.
I tried my best in writing this, to understand it the easy way.

Type Conversions

Most of the time, operators & functions automatically convert the vals given to them to the right type.

Image description

String Conversion
Image description

Number Conversion
Conversion happens in Mathematical functions & expressions automatically.

Image description

A valid string(number) will be converted to valid number

Image description

Invalid string(number) results in NaN

Image description

Math conversion rules:
Image description

Boolean Conversion
Few valid boolean conversions that results in false

Image description

Examples of boolean conversion:

Image description

Leave y'r thoughts....

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay