JSFiddle - React, Tailwind, and code Playground
by Daniel Lamb
JavaScript
// jQuery
// arrange
function doStuff(){
return 42;
}
function myMethod(callback) {
// do stuff and return the result
var result = doStuff();
(callback || $.noop)(result);
}
// act
myMethod();
// assert: should not throw an error when callback is omitted.