theonlychase
4/30/2019 - 1:07 AM

isNaN()

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")