actually map itself has nothing to do with the repeat - it just passes the element's index to the callback function. the repetition is provided by repeat() getting the index in this specific case.
I guess you learn something new everyday lol, I had no idea you could add an incrementor to map(). I guess it's because map() is an iterative method, there's a couple of examples of an index being used with map() on the mdn, but it isn't explicitly stated anywhere else to my knowledge.
I understand everything about this, except for why the "i" actually works as the repeat attribute? Why does this work? I understand everything about it except for that. I looked up various description about how the map function is supposed to work but I just don't get it. I used map before and it always did what I thought it would but in this case I'm just stumped.
This comment is hidden because it contains spoiler information about the solution
Great result, but your Big O code is O(n^2) and maybe it's a problem. But nice is shorter than my result.
This comment is hidden because it contains spoiler information about the solution
NICE!!!
The way i like loops this wont occur to me at all
actually map itself has nothing to do with the repeat - it just passes the element's index to the callback function. the repetition is provided by repeat() getting the index in this specific case.
I guess you learn something new everyday lol, I had no idea you could add an incrementor to map(). I guess it's because map() is an iterative method, there's a couple of examples of an index being used with map() on the mdn, but it isn't explicitly stated anywhere else to my knowledge.
I understand everything about this, except for why the "i" actually works as the repeat attribute? Why does this work? I understand everything about it except for that. I looked up various description about how the map function is supposed to work but I just don't get it. I used map before and it always did what I thought it would but in this case I'm just stumped.
Who are these people!?
I know all of these methods, but didn't think of combining them in this fashion! Nice one! :)
Study array methods, itll save you time and make the code cleaner
console.log('damn '.repeat(3));
Clever solution.
How do people realize this is the solution? mine's nested loops with a nasty amount fixes, i have a long way to go
damn * damn * damn repeat
Loading more items...