JSFiddle - React, Tailwind, and code Playground
JavaScript
function callWrapper(cb = Function()) {
cb();
}
function test() {
let foo = 'bar';
callWrapper(function() {
console.log(foo); // bar
});
}
test();
function callWrapper(cb = Function()) {
cb();
}
function test() {
let foo = 'bar';
callWrapper(function() {
console.log(foo); // bar
});
}
test();