Just curious as to why its not printing both peter.attack() and kegann.attack() in the console.
console for this function:
"attacks with fire"
function createElf(name, weapon) {
return {
name,
weapon,
attack(){
return 'attack with ' + weapon
}
}
}
const peter = createElf('Peter', 'stones')
peter.attack();
const kegann = createElf('Sam', 'fire')
kegann.attack();