basic knowledge I've learned to this far.
I have a problem in my code. In the if-else construct i have typeof, but it doesn't work the way i thought it should. If i type a number it should respond “You have entered an invalid name.” but it doesn't, why? Also, console.log(typeof newUser) outputs 'string' even if i have entered a number in the prompt.
because name will always be string. node doesn't try to parse it, it returns the plain string
Обсуждают сегодня