JSFiddle - React, Tailwind, and code Playground
JavaScript
let athleteArray = [
rupert = {
name: 'Rupert',
age: '33',
sport: 'sitting',
quote: 'Hello Super nintendo chalmers'
},
alice = {
name: 'Alice',
age: '35',
sport: 'cooking',
quote: 'stop that'
}
];
const win = function(name, sport){
console.log(`${name} won the ${sport} event!`)
}
for(let i = 0; i < athleteArray.length; i++){
athleteArray[i].win = win(athleteArray[i].name,
athleteArray[i].sport)
console.log(athleteArray[i])
console.log(typeof(athleteArray[i].win))
}