Skip to content

Day 5: Strings Deep Dive & Week 1 Mini-Project

Master modern string manipulation with template literals, inspect string methods, and complete the Week 1 mini-project.

Template literals use backticks (`) to interpolate variables and support multi-line strings cleanly:

const item = 'Mechanical Keyboard';
const price = 80;
const taxRate = 0.21;
const total = price * (1 + taxRate);
const summary = `Product: ${item}
Subtotal: $${price}
Total with VAT: $${total.toFixed(2)}`;
console.log(summary);
const text = 'Mastering Modern JavaScript';
console.log(text.length); // 27 characters
console.log(text.toUpperCase()); // "MASTERING MODERN JAVASCRIPT"
console.log(text.toLowerCase()); // "mastering modern javascript"
console.log(text.includes('Modern')); // true
console.log(text.slice(0, 9)); // "Mastering"

Week 1 Mini-Project: VAT Shopping Receipt Calculator

Section titled “Week 1 Mini-Project: VAT Shopping Receipt Calculator”

Project Requirements:

  1. Declare constants for product name, item price, quantity, and VAT percentage.
  2. Calculate subtotal, VAT amount, and final total.
  3. Use string methods to format the product name in uppercase.
  4. Output a formatted receipt in the console using a multi-line template literal with currency decimals (.toFixed(2)).