- script.js
JavaScript
var onVacation = false;
if (true) {
console.log('You cannot start the project');
} else {
console.log('You can start the project');
}
Result
Goalscompleted
Let’s fix the program and experiment with the value of the variable onVacation.
- Replace the condition in
ifwithonVacation. - Set the
onVacationvariable totrue. - And now to
2. The number is not equal to zero and casts totrue. - And to
0. The message should change. - Now to
''. - And, finally, remove the assignment from the declaration, leaving just
var onVacation;.
Comments