Can i have you help, please for this task ?
I have to create a function greetingTemp(greeting), where the parameter is greeting text like : Good morning, Good evening etc
Function greetingTemp return a nested function greetingPers(name). The func take 1 paramether - persons name and has to output greeting like : Good Morning,Leo!
I have to declarate 2 var one for good morning and one for Good evening with values the results of calling greetingTemp() with the corresponding parameter
This is my code:
function greetingTemp(greeting){
console.log("Good morning, " + greeting + "!")
function greetingPers(name){
return `${greeting}, ${name}`
}
return greetingPers
}
let gm = greetingTemp("jordan")
Im sure this code is correct, but i didnt understand also how this can be done
declarate 2 var one for good morning and one for Good evening with values the results of calling greetingTemp() with the corresponding parameter
What I have tried:
function greetingTemp(greeting){
console.log("Good morning, " + greeting + "!")
function greetingPers(name){
return `${greeting}, ${name}`
}
return greetingPers
}
Im not sure how to present in the code this good morning and good evening