Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ Output: "The late fee is $2.50."

// ✍️ ✍️ ✍️ ✍️ Write the function here ✍️ ✍️ ✍️ ✍️

function calculateLateFee() {

const numberofOverdueDays = prompt("Enter the number of overdue days:");
const feePerDay = 0.25;
const totalFee = Number(numberofOverdueDays) * feePerDay;
console.log("The late fee is $" + totalFee);
}

calculateLateFee();


// Extra Task:
Expand Down Expand Up @@ -45,7 +54,23 @@ Output: "Red: You are passionate and bold."

// ✍️ ✍️ ✍️ ✍️ Write the function here ✍️ ✍️ ✍️ ✍️

const findColorMeaning = function() {
const color = prompt("What is your favorite color?");
if (color.toLowerCase() === "blue") {
console.log("Blue: You love calm and peace.");
} else if (color.toLowerCase() == "red") {
console.log("Red: You are passionate and bold.");
} else if (color.toLowerCase() == "green") {
console.log("Green: You are connected to nature.");
} else if (color.toLowerCase() == "yellow") {
console.log("Yellow: You radiate happiness and energy.");
} else {
console.log("That's a unique choice!");
}

}

findColorMeaning();

// Extra Task:
// - Rewrite the function using an arrow function.
Expand All @@ -68,7 +93,9 @@ Output: "Case #12345: John Doe's case is now logged."

// ✍️ ✍️ ✍️ ✍️ Write the function here ✍️ ✍️ ✍️ ✍️


function logCase(clientName, caseNumber) {
console.log("Case #" + caseNumber + ": " + clientName + "'s case is now logged.");
}

// Extra Task:
// - Rewrite the function as an arrow function.
Expand All @@ -94,7 +121,13 @@ Output: "Amina is present."

// ✍️ ✍️ ✍️ ✍️ Write the function here ✍️ ✍️ ✍️ ✍️


function markAttendance(studentName, isPresent) {
if (isPresent) {
console.log(studentName + " is present.");
} else {
console.log(studentName + " is absent.");
}
}

// Extra Task:
// - Convert the function into a function expression.
Expand Down