Response:
Code:
const example = {
scope: null
};
example.message = (args) => {
if(args.log) console.log(args.log);
if(args.msg) document.getElementById('viewport').innerHTML = args.msg;
};
example.process = () => {
let screen = example.closure('alpha');
example.message({ msg: screen('bravo'), log: screen('bravo') });
};
example.closure = (x) => {
return function (y)
{
return x + ', ' + y;
}
};
example.init = () => {
example.process();
};
document.addEventListener('DOMContentLoaded',example.init);