Skip to content

Instantly share code, notes, and snippets.

@theonlychase theonlychase/isNaN
Last active May 2, 2019

What would you like to do?
Test if a string is not equal to NaN
// Create a function that splits these strings into their alphabetic and numeric parts.
function splitCode(item) {
let nums = item.split("").filter(val => !isNaN(val)).join("");
let str = item.split("").filter(val => !nums.includes(val)).join("");
return [str, parseInt(nums)]
// if "+" or "-" is included at the beginning of a string of numbers, !isNan() will be true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.