Welcome to the Linux Foundation Forum!

Lab5-1

Interaction between prefixer and sayHi/sayBye

When the function prefixer is defined, an error message is displayed that sayHiTo and sayBye are undefined,
and vice versa.

Can I define dual functions at once?

'use strict'

const sayHiTo = prefixer('Hello ')
const sayByeTo = prefixer('Goodbye ')

console.log(sayHiTo('Dave')) // prints 'Hello Dave'
console.log(sayHiTo('Annie')) // prints 'Hello Annie'
console.log(sayByeTo('Dave')) // prints 'Goodbye Dav'

Comments

Sign In or Register to comment.