Sitemap
Sean O'Neill

Sean O'Neill

— Here —

Javascript Practice Log, day 1

1 min readAug 3, 2015

As a means of staying on my game, I’m going to try to start regularly posting javascript snippets and solutions to little challenges I run across. The other day I saw a reddit post where a guy was detailing the Angular and javascript questions he came across in interviews. Seemed like a good start.

Get Sean O'Neill’s stories in your inbox

Join Medium for free to get updates from this writer.

Problem: Add a “repeatify” method to the String object that will take an integer parameter and log the string to the console a certain number of times. This was my first go at the problem (pre-Googling):

After a quick googling, I found a much more elegant solution; simply create an array using new Array (something I’ve rarely needed to do), and give it enough space to hold the string x number of times, like so:

--

--