Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function cookingNums(input) {
- let operations = {
- chop : x => x / 2,
- dice : x => Math.sqrt(x),
- spice : x => x + 1,
- bake : x => x * 3,
- fillet : x => x - (0.2 * x)
- }
- let number = Number(input[0]);
- let commands = input.slice(1);
- for (let command of commands){
- number = operations[command](number);
- console.log(number)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement