Revisiting JavaScript this week - I think my solution to the wordsearch puzzle grid problem is particularly elegant. Check out my Solution here
I also tweeted about an elegant recursive algorithm I devised to generate integer sequences in JavaScript (which is utilized in the word search challenge) Some languages (Ruby, Haskell) use syntax like [1..10] to represent an integer sequence, but JavaScript doesn’t have a built-in way to do this, so I created my own.
Languages such as Haskell can create an integer sequence (say 1 to 5) with syntax as facile as [1..5].#JavaScript, however, grants no such convenience, not even an object method.
— Zack Hartmann (@zack_hartmann) April 6, 2019
So, to achieve this, here is a recursive function of my own devising 🤓@CareerDevs #SiliconRhode pic.twitter.com/556NhSao1e
function intSequence(start, end, n = start, arr = []) {
return n === end ? arr.concat(n)
: intSequence(start, end, start < end ? n + 1 : n - 1, arr.concat(n));
}
[Read More]