Thanks @tanth1993
! It is definitely possible to use a switch! It may not be the best application since there's not just one expression we're evaluating, but it is an option we can explore. Here's what the function could look like using a switch statement (note that we don't need to use break in each case because the function stops when something is returned):
nice article.
In function deepCloner, could we use switch...case instead of if/else?
Thanks @tanth1993 ! It is definitely possible to use a switch! It may not be the best application since there's not just one expression we're evaluating, but it is an option we can explore. Here's what the function could look like using a switch statement (note that we don't need to use
break
in each case because the function stops when something is returned):Hope this helps!
Wow. Nice! thank you for sharing this.