exercise3.js
JavaScript/modules/module1-foundations/code-examples/lesson3/exercise3.js
// Exercise 3: Age Verification
let age = 20;
let hasLicense = true;
let canVote = age >= 18;
let canDrive = age >= 16 && hasLicense;
let canDrink = age >= 21;
console.log("Age:", age);
console.log("Has license:", hasLicense);
console.log("Can vote:", canVote); // true
console.log("Can drive:", canDrive); // true
console.log("Can drink:", canDrink); // false
Related articles
exercise1.js
exercise1.js — javascript source code from the JavaScript learning materials (JavaScript/modules/module1-foundations/code-examples/lesson1/exercise1.js).
Read article →exercise2.js
exercise2.js — javascript source code from the JavaScript learning materials (JavaScript/modules/module1-foundations/code-examples/lesson1/exercise2.js).
Read article →exercise3.js
exercise3.js — javascript source code from the JavaScript learning materials (JavaScript/modules/module1-foundations/code-examples/lesson1/exercise3.js).
Read article →hello.js
hello.js — javascript source code from the JavaScript learning materials (JavaScript/modules/module1-foundations/code-examples/lesson1/hello.js).
Read article →exercise1.js
exercise1.js — javascript source code from the JavaScript learning materials (JavaScript/modules/module1-foundations/code-examples/lesson2/exercise1.js).
Read article →exercise2.js
exercise2.js — javascript source code from the JavaScript learning materials (JavaScript/modules/module1-foundations/code-examples/lesson2/exercise2.js).
Read article →