generated from skills/copilot-codespaces-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75ebd04
commit c4e0e61
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
|