I was trying to check a value that cames as a string is actually a string or a number and tried this:
let k = "a5b";
for(var i = 0; i < k.length; i++){
var currentVal = k[i]
if(typeof currentVal != " number"){
console.log(currentVal + " is a letter")
}
else{
console.log("its a number")
}
}
But, it didn't work. I'm trying to implement this approach to check if a returned value in the form of a string is a number or a word. How could I make it detect wether there is actually a number inside or not?