How to call this procedure with Javascript function

Asked

Viewed 24 times

0

Hello, I watched a video class, on Composition of Functions in Javascript, and the teacher, at one point used a function syntax similar to this my example:

function teste(valor1){
    return function(valor2){
        return valor2*valor1
    }
}
const numeroX = teste(10)(30);
console.log(numeroX);

Questions: (1) What is this characteristic of the language called? (2) If 10 (first parameter) is the parameter for the function teste, Does Javascript understand that another parameter, in sequence, delimited by parentheses, will be parameter for some internal function? (3) can I put (and use) how many parameters you want for other nested functions, is that it? P.S.: the teacher did not specifically explain this, because it was not the focus of the class, and the video is a little old. detalhe

  • see if this helps: https://answall.com/q/1859/57220

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.