JavaScript Type Conversion

This post aims to only list out the most common use of JavaScript Type Conversions:

Convert to Boolean:

var boolValue = !!x;

Convert to String:

var stringValue = ""+x;

Convert to Number:

var numValue = +x;

Yang Zhao

Read more posts by this author.


Comment