var x = 12 * “text”;
isNaN(x); // Function returns ‘true’
As you can see above, we have attempted to multiply a number with a string, which is obviously not possible, so it gets set to ‘NaN’, and, as such, when we pass the variable to the isNaN function, the function checks if the variable is set to NaN, and when it realizes that it is set to NaN, it returns true.
As we have seen already in this book, strings are the data type used for storing text. Nice and simple, right? Before we dig into what we are able to do without strings, let’s take another look at how we define a string.