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
38 changes: 38 additions & 0 deletions sharing-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,41 @@ reusable functions that solve specific tasks. This activity encourages:
// - Explain how your team approached the design and testing process

// ✅ Bonus: Can you extend any of the functions to be more flexible or reusable?

//task1
function assignRole(name,role){
let roleType = role.charAt(0).toUpperCase()+role.slice(1);

return console.log("name: ",name, ",","Role: ", roleType);
}
assignRole("Alice", "speaker");

//task2


function calculateEventCost(numberOfAttendees,costPerAttendee){
let totalCost = numberOfAttendees + costPerAttendee;
if(numberOfAttendees > 100){
totalCost = totalCost*0.9;
return console.log("10% discount is applied and total cost is :", totalCost);
}else{
return console.log("total cost is :", totalCost)
}

}
calculateEventCost(60, 90);
calculateEventCost(120,90);

//Task 3: Validate Email


function validateEmail(emailString){
if(emailString.includes("@")&&emailString.includes(".")){
return console.log("Valid Email");
}else{
return console.log("Invalid Email");
}
}
validateEmail("launchcode@gmail.com");
validateEmail("launchcode.com");