Practice & Assessment
Test your understanding of JavaScript Basics: Variables, Data Types, and Operators
Multiple Choice Questions
5Which keyword should you use by default for declaring variables in modern JavaScript?
What does the typeof operator return for an array?
What is the result of '5' + 3 in JavaScript?
What does the nullish coalescing operator (??) do?
What is the key difference between null and undefined in JavaScript?
Coding Challenges
1Shopping Cart Price Calculator
Create a script that declares variables for three product names, their prices, and quantities. Calculate the subtotal for each product, the overall total, a 10% discount if the total exceeds 100, and the final price after the discount. Display all values using console.log with descriptive labels.
Mini Project
Interactive Unit Converter
Build an HTML page with an input field and buttons. The user types a number and can click buttons to convert it between kilometres and miles, Celsius and Fahrenheit, and kilograms and pounds. Display each converted result on the page using innerHTML. Use const and let appropriately, apply the correct arithmetic operators for each formula, and format all outputs to two decimal places using toFixed(2).
