JSFiddle - React, Tailwind, and code Playground

by somekittens

JavaScript

// parseInt takes a string and tries to make a number:
var x = parseInt('12');
console.log(x === 12); // logs `true`

// If it doesn't get a number, parseInt will return `NaN` (not a number)
console.log(parseInt('RocketU')); // Logs `NaN`

// You can test if something is NaN through the helpfully-named isNaN
var notReallyANumber = parseInt('Eleventy-Billion');
console.log(isNaN(notReallyANumber)); // Logs `true`