User Tools

Site Tools


java-script:dynamic-function-invocation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
java-script:dynamic-function-invocation [2023/08/10 15:45] odeftajava-script:dynamic-function-invocation [2023/08/10 15:46] (current) odefta
Line 23: Line 23:
 const methodName = 'greet'; const methodName = 'greet';
 obj[methodName]('John'); // Output: Hello, John! obj[methodName]('John'); // Output: Hello, John!
 +</code>
 +
 +<code javascript>
 +function myConsole(method, ...items) {
 +    console[method](items.join(', ')); 
 +
 +myConsole('info', 1, 2, 3, 4);
 </code> </code>
  
java-script/dynamic-function-invocation.1691671537.txt.gz · Last modified: 2023/08/10 15:45 by odefta