How to pass arguments to an anonymous function in JavaScript

2 Answers

0 votes
const say = function(s) {
    console.log("ABC " + s);
};

say("XYZ");



/*
run:

ABC XYZ

*/

 



answered Feb 22 by avibootz
0 votes
const say = function(s, n) {
    console.log("ABC " + s + " " + n);
};

say("XYZ", 123);



/*
run:

ABC XYZ 123

*/

 



answered Feb 22 by avibootz
...