100 Days Of Javascript

Coercion in Javascript

Day 3: Coercion

To oversimplify this is the act of converting a value from one type to another. An array to a number, a string to an boolean etc.

var a = 42;
var b = a + ""; // implicit coercion
var c = String( a ); // explicit coercion

You Don’t Know JS

By Joseph Dickson

Joseph Dickson is a web developer in higher education and an avid proponent of using WordPress’ core features to create flexible and manageable design solutions.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.