21 lines
No EOL
534 B
HTML
21 lines
No EOL
534 B
HTML
<script>
|
|
function mul(a, b) {
|
|
return a * b;
|
|
};
|
|
|
|
function ask(question, answer, ok, fail) {
|
|
let result = prompt(question, '');
|
|
if (result.toLowerCase() == answer.toLowerCase()) ok();
|
|
else fail();
|
|
}
|
|
|
|
function bind(func, context /*, args*/) {
|
|
let bindArgs = [].slice.call(arguments, 2); // (1)
|
|
function wrapper() { // (2)
|
|
let args = [].slice.call(arguments);
|
|
let unshiftArgs = bindArgs.concat(args); // (3)
|
|
return func.apply(context, unshiftArgs); // (4)
|
|
}
|
|
return wrapper;
|
|
}
|
|
</script> |