1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-11-24 09:41:55 +01:00
CodeWars/5kyu/calculating_with_functions/solution.js
Matej Focko fc899b0b02
chore: initial commit
Signed-off-by: Matej Focko <mfocko@redhat.com>
2021-12-28 16:19:58 +01:00

15 lines
967 B
JavaScript

function zero(operand=null) { return (operand) ? operand(0) : 0; }
function one(operand=null) { return (operand) ? operand(1) : 1; }
function two(operand=null) { return (operand) ? operand(2) : 2; }
function three(operand=null) { return (operand) ? operand(3) : 3; }
function four(operand=null) { return (operand) ? operand(4) : 4; }
function five(operand=null) { return (operand) ? operand(5) : 5; }
function six(operand=null) { return (operand) ? operand(6) : 6; }
function seven(operand=null) { return (operand) ? operand(7) : 7; }
function eight(operand=null) { return (operand) ? operand(8) : 8; }
function nine(operand=null) { return (operand) ? operand(9) : 9; }
function plus(right) { return (x) => x + right; }
function minus(right) { return (x) => x - right; }
function times(right) { return (x) => x * right; }
function dividedBy(right) { return (x) => Math.floor(x / right); }