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
57 changes: 55 additions & 2 deletions challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ Output: "The late fee is $2.50."

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

function calculateLateFee () {
const overduedays =prompt("how many days is the books overdue")
const lateFee = 0.25
const totall = overduedays *lateFee
console.log(`the late fee is ${totall}`)
}
calculateLateFee()


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

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


function findColorMeaning(color){
const prompt=("player what is your favorite color")
if (color === "Blue" ){
console.log("${color} You love calm and peace")
} else if (color === "Red"){
console.log("${color} You are passionate and bold");
} else if (color === "green"){
console.log("${color} You are connected to nature");
} else if (color === "yellow"){
console.log("yellow, You radiate happiness and energy")
} else {
console.log("that' s a unique choice")
}
}
const findColorMeaning2=(color) => {
console.log(`player what is your favorite color`)
}
findColorMeaning()

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

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

function logCase(clientName, caseNumber) {
console.log(` Case ${caseNumber}: ${clientName} case is now logged`);
}

const logCase2 = (clientName, caseNumber) => {

console.log(` Case ${caseNumber}: ${clientName} case is now logged`);
}

logCase("John Doe", 12345)



// Extra Task:
Expand Down Expand Up @@ -95,10 +130,28 @@ Output: "Amina is present."
// ✍️ ✍️ ✍️ ✍️ Write the function here ✍️ ✍️ ✍️ ✍️


function markAttendance(studentName,isPresent){
if (studentName, isPresent){
console.log(`${studentName} ispresent`)
} else {
console.log('${studentName} is absent')}
}

markAttendance()


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

const markAttendace2= function(studentName, isPresent){
if (studentName,isPresent){
console.log(`${studentName} is present`)
} else {
console.log(`${studentName} is absent`);}
}





/*
Expand Down Expand Up @@ -134,4 +187,4 @@ Output:
Extra Credit:
- Extend the program to accept multiple students' names and scores and generate a report for each student using a loop.
- Use an arrow function for at least one of the functions.
*/
*/
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>