console.log("case 1")
var event = "Year 2021";
console.log(typeof(parseInt(event.split(" ").pop())) === "number");
console.log("case 2")
var event = "Year mukesh";
console.log(typeof(parseInt(event.split(" ").pop())) === "number");
console.log("case 3")
var event = "Year mukesh";
console.log(typeof(event.split(" ").pop()) === "number");
console.log("case 4")
var event = "Year 2021";
console.log(typeof(event.split(" ").pop()) === "number");
case 1 demonstrates that using parseInt on a proper number at the end of a string gives us a true value, which is valid.
In case 2, when there's a non-numeric string at the end and we use parseInt, it surprisingly returns a valid number type, resulting in a false outcome.
Case 3 showcases that without parseInt, a string at the end correctly gives us a false result.
Case 4 shows that even with a number at the end, not using parseInt still yields a false result because the number is within quotation marks, making it a string.
Now, the challenge is determining whether the last element in an array is a string or an integer since user input could be any mix of strings and numbers such as "Hello darkness" or "Hello 221".