Day 6 — declarations, arrows, defaults

Homework

Problem 1 Part 1
function kmToMiles(km) {
  return km * 0.621;
}

Reference solution lives in ../js/homework.js (loaded at the bottom of this page).

Problem 2 Part 2
console.log(kmToMiles(10));

Reference solution lives in ../js/homework.js (loaded at the bottom of this page).

Problem 3 Part 3
function gstAmount(price, rate = 18) {
  return (price * rate) / 100;
}

Reference solution lives in ../js/homework.js (loaded at the bottom of this page).

Problem 4 Part 4
console.log(gstAmount(1000));

Reference solution lives in ../js/homework.js (loaded at the bottom of this page).

Problem 5 Part 5
function fullName(first, last) {
  return `${first} ${last}`;
}

Reference solution lives in ../js/homework.js (loaded at the bottom of this page).

Problem 6 Part 6
console.log(fullName("sai", "Kalyan"));

Reference solution lives in ../js/homework.js (loaded at the bottom of this page).

Problem 7 Part 7
function isAdult(age) {
  return age >= 18;
}

Reference solution lives in ../js/homework.js (loaded at the bottom of this page).

Problem 8 Part 8
console.log(isAdult(20));

Reference solution lives in ../js/homework.js (loaded at the bottom of this page).