function createMessage() { var string = ''; var str; console.log('начальное значение аргумента: ' + str); return function callback(){ str = arguments[0]; console.log('значение аргумента в callback: ' + str); if (str !== undefined){ string += str; console.log('значение string в callback: ' + string); return callback(); } return string; } //console.log('вызов callback: ' + callback()); return string; } console.log(createMessage("Hello")("World!")("how")("are")("you?")());// должно возвратить "Hello World! how are you? In my case, it loops on the first argument "Hello", the argument does not change
Uncaught TypeError: createMessage(...)(...) is not a function:Uncaught TypeError: createMessage(...)(...) is not a function, which is generally logical.createMessage("Hello" /* argument is ignored */)("World!" /* returns "World!" */)/* not a function */("how")...- Qwertiy ♦