Skip to content

Commit

Permalink
Copilot second commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gachokahassan committed Jun 12, 2024
1 parent 75ebd04 commit c4e0e61
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions member.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function skillsMember() {
const member = { name: 'Alice', skills: [] };

return {
addSkill: skill => {
if (!member.skills.includes(skill)) member.skills.push(skill);
},
listSkills: () => console.log(member.skills.length ? `${member.name}'s skills: ${member.skills.join(', ')}` : `${member.name} has no skills.`),
removeSkill: skill => {
const index = member.skills.indexOf(skill);
if (index > -1) member.skills.splice(index, 1);
}
};
}

// Example usage:
const member = skillsMember();
member.addSkill('JavaScript');
member.addSkill('Python');
member.listSkills();
member.removeSkill('JavaScript');
member.listSkills();
member.removeSkill('Ruby');

0 comments on commit c4e0e61

Please sign in to comment.