I have this basic code and it works well when I write the name.
var user = prompt("Cual es tu nombre").toLowerCase();
if (user) {
console.log("Hola " + user);
} else if (user === null) {
console.log("Adios " + user);
}
The problem comes when I give it to cancel. I miss this error in the console:
Uncaught TypeError: Can not read property 'toLowerCase' of null
Is there any way I can print the content if cancel is given?