I use a function that check if entered value is a valid text for specific purpose in my application.
valid value is a string where it's not valid date or number neither true or false.
checkText(str) {
return isNaN(str) && isNaN(Date.parse(str)) && ['true', 'false'].indexOf(str) == -1;
}
It works properly, but i faced an issue with this string: "New Item 3".
Date.parse("New Item 3")
returns a number, but why!!? also, if you changed 3 into any number less than 13 it will return number!
Anyone here can explain to me what happens?