Welcome to the Linux Foundation Forum!

Lab 5.1

Hi,
can someone help me with implementing the function prefixer? I'm a bit lost.

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


function prefixer (str) {
    console.log(str);
    }


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

Thx a lot

Comments

    • Return a function from prefixer that accepts an argument
    • concat (e.g. use +) the out str argument and the returned functions argument together

Categories

Upcoming Training