Imagine I had a function called multi0(Array) and I wanted it to take an Array as an argument.
If I did multi0([5]), it would return an array that looks like
[0,0,0,0,0]
If I did multi0([5,3]), it would return an array that looks like
[
[0,0,0],
[0,0,0],
[0,0,0],
[0,0,0],
[0,0,0]
]
I attempted this with recursion, but it didn’t work. How do you implement this?
Like this:
http://jsfiddle.net/ffuH4/
Or the slightly longer but more effective: