scrimba
The Ultimate JavaScript Bootcamp
Even shorter conditionals with short-circuiting
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Even shorter conditionals with short-circuiting
AboutCommentsNotes
Even shorter conditionals with short-circuiting
Expand for more info
index.js
run
preview
console
const response = prompt("What’s your name?");

let username;

if (response) {
username = response;
} else {
username = "guest";
}

console.log(username);
Console
index.html
-9:01