Skip to content
Open
Show file tree
Hide file tree
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
43 changes: 40 additions & 3 deletions challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,27 @@ Output: "The late fee is $2.50."
*/

// ✍️ ✍️ ✍️ ✍️ Write the function here ✍️ ✍️ ✍️ ✍️
const calculateLateFee = ()=>{
const overdues = prompt("put number of overdues you have")
const latefee= 0.25;
const total = latefee*overdues
console.log(`The late fee is ${total}`)
}
calculateLateFee(10)



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


// Extra Task:
// - Convert the function into a function expression.
const calculateLateFee1 = function(){
const overdues = prompt("put number of overdues you have")
const latefee= 0.25;
const total = latefee*overdues
console.log(`The late fee is ${total}`)
}
calculateLateFee1()

/*
Task 2 : Favorite Color Finder 🚀🚀🚀🚀
Expand All @@ -44,7 +58,19 @@ Output: "Red: You are passionate and bold."
*/

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

const findColorMeaning = ()=>{
const favcolor = prompt("pick your favorite color")
if (favcolor === "blue"){
console.log("You love calm and peace.")
}else if(favcolor==="red"){
console.log("you are passionate and bold.")
}else if(favcolor==="green"){
console.log("You are connected to nature.")
}else if(favcolor==="yellow"){
console.log("You radiate happiness and energy.")
} else console.log("That's a unique choice")
}
findColorMeaning("red")


// Extra Task:
Expand All @@ -68,6 +94,10 @@ Output: "Case #12345: John Doe's case is now logged."

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

const logCase = (clientName,caseNumber)=>{
console.log(`Case #${caseNumber}: ${clientName}'s case is now logged. `)
}
logCase("John Doe", 12345);


// Extra Task:
Expand All @@ -94,6 +124,13 @@ Output: "Amina is present."

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

const markAttendance =(studendentName,isPresent)=>{
if(isPresent){
console.log(`${studendentName} is Present`)
}else console.log(`${studendentName} is Absent`)
}
markAttendance("amina",false)



// Extra Task:
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
</head>
<body>
<h1>Check the console log for changes</h1>

<script src="challenges.js"></script>
</body>
</html>