Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function myFunc(num, ...param) {
- num = Number(num)
- actions = {
- chop: (num) => num / 2,
- dice: (num) => Math.sqrt(num),
- spice: (num) => ++num,
- bake: (num) => num * 3,
- fillet: (num) => num * 0.8
- }
- while (param.length > 0){
- command = param.shift()
- num = actions[command](num)
- console.log(num)
- }
- }
- myFunc('9', 'dice', 'spice', 'chop', 'bake', 'fillet')
Advertisement
Add Comment
Please, Sign In to add comment