Process one or multiple arguments within a function
· ☕ 2 min read
Let’s say you have to write a function that doubles a given number. You also find out that you may get one number (in which case double that number), or multiple numbers (double all numbers).
The first thought that comes to mind is to -
use different functions (or) check type of input and process differently Consider the below code -