Toggle navigation
Genres
Frontend (2)
JavaScript (6)
Database (2)
Linux Server (3)
Web Apps (4)
Misc (4)
Search
List
New Tutorials
Last Modified Tutorials
</>
Code examples
code
smiko
javascript
advanced
functions
03fun_parameter_callback3.js
03fun_parameter_callback3.js
/** * callback as function parameter */ //define function with callback function fja(p1, cb) { res = p1 +10; cb(p1); } //define parameters var x=2; //callback as an object var obj = { cb1: function(a) { console.log('cb1: '+a); }, cb2: function(a) { console.log('cb2: '+a); } } //call function var res = fja(x, obj.cb1); //2
Reload page
Preview
W3C validation
Edit Code
JS Console