Skip to content

Day 1: Declarations, Parameters & Return

Encapsulate logic into reusable blocks with parameters and return values.

function calculateTotal(price, quantity) {
const subtotal = price * quantity;
return subtotal;
}
const orderTotal = calculateTotal(25, 4);
console.log(orderTotal); // 100
  1. Write a function celsiusToFahrenheit(celsius) that returns the converted temperature.
  2. Write a function isEven(num) that returns true or false.