JSFiddle - React, Tailwind, and code Playground
by rmurphey
JavaScript
var obj = {
say : function(greeting, person, exclaim) {
console.log(greeting + ', ' + person + (exclaim ? '!' : ''));
}
};
var messages = dojo.map(['hello', 'hi', 'greetings'], function(greeting) {
// create a function with its first argument
// already baked in
return dojo.hitch(obj, 'say', greeting);
});
dojo.forEach(messages, function(msg, i) {
// pass more args to the original function,
// calling it at the same time
msg('Adam', i % 2);
});