Skip to content

Instantly share code, notes, and snippets.

@theredfish
Last active September 7, 2018 14:52
Show Gist options
  • Save theredfish/127957ffd90639c361e1038faac0bd4e to your computer and use it in GitHub Desktop.
Save theredfish/127957ffd90639c361e1038faac0bd4e to your computer and use it in GitHub Desktop.
Composition in js
function display_param(fn, param) {
console.log(fn(param));
}
function add_x_to_param(param) {
return param+"x";
}
display_param(add_x_to_param, "yolo_swag_");
function display (fn) {
console.log(fn());
}
let get_param_x = function() {
return "yolo_swag_x";
}
display(get_param_x);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment