Skip to content

Instantly share code, notes, and snippets.

@theonlychase theonlychase/isNaN
Last active May 2, 2019

Embed
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)]
}
splitCode("TEWA8392")
// NOTE
// if "+" or "-" is included at the beginning of a string of numbers, !isNan() will be true
!isNaN("-565")
!isNaN("+565")
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.