Pascal’s Triangle in Javascript 6 (ES6)

So I was reading a post on reddit where it was mentioned that on a interview for javascript developer they asked to write a function that returns n lines of Pascal’s Triangle.

My first reaction was of course: What is a Pascal Triangle? After reading wikipedia I said, ok let’s give it a try. At the end I didn’t make a function, but a whole ES6 class that renders it nicely to the browser.

Check out the codepen:

See the Pen A Pascal Triangle in ES6 by Jean-Pierre Sierens (@jpsierens) on CodePen.

If you want to start using ES6 in your projects, check out this tutorial I wrote.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *