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
34 changes: 34 additions & 0 deletions sharing-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ reusable functions that solve specific tasks. This activity encourages:
// 3. Capitalize the role if needed.
// 4. Return the result.

function attendeeBadge(name,role){

return `Name: ${name} , Role: ${role}`;

}
console.log(attendeeBadge("Alice","Speaker"));

// ============================================
// 🧩 Task 2: Calculate Event Cost
Expand All @@ -51,6 +57,19 @@ reusable functions that solve specific tasks. This activity encourages:
// 3. If so, apply a 10% discount.
// 4. Return the final total.

function event(numberOfAttendee,costPerAttendee){

totalCost = numberOfAttendee * costPerAttendee;

if (numberOfAttendee > 100)
{
totalCost *= 0.9;

}
return totalCost;
}
console.log(event(101,50));
console.log(event(50,40));

// ============================================
// 🧩 Task 3: Validate Email
Expand All @@ -64,6 +83,20 @@ reusable functions that solve specific tasks. This activity encourages:
// 1. Check if the string includes both "@" and ".".
// 2. Return true or false accordingly.

function validEmail(email)
{
return email.includes('@') && email.includes('.') ;
}
console.log(validEmail("mailid@gmail.com"));
console.log(validEmail("mailid@gmailcom"));

//Goal: Create a personalized badge string.
//input: name (string).role (string).
//output: formated string "Name: Alice, Role: Speaker"





// ============================================
// 🧠 Collaborative Steps
Expand All @@ -89,3 +122,4 @@ 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?
g