Answer the question
In order to leave comments, you need to log in
How to use closures to implement the memorization of words?
Hello everyone, I can not implement the task, which consists in the fact that the function needs to "remember" the words that I pass as a parameter. i.e. if I call like this:
const concat = function (str) {
let word = str;
return function (newWord) {
return word + newWord;
}
}
let memorize = concat('test')
console.log(memorize('test2'))
console.log(memorize('test3'))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question