✅ Check out Dave Gray's YouTube Channel with all of my tutorials.
Description:
I Have Only One Javascript Question... It is hard to imagine, but a Reddit post reported a job interview with only one Javascript question. In this Javascript tutorial, we'll answer that question and break down the logic behind the answer.
YouTube Tutorial for this repository.
I suggest completing Dave Gray's 8 hour JavaScript course tutorial video if you are new to Javascript.
My Modifications:
- Use
(n, k)
variable to match ones from Wikipedia - Start with none empty array const
stackArray = [ [1] ]
; - Remove the if statement to set first/last cell value, we would rather calculate their values (the Nullish coalescing operator comes in handy here)
- Collapse the borders of consecutive squares
- Adding
odd
class on squares with odd values to make the pascal's triangle pattern standout a little bit.
DO NOT COPY FOR AN ASSIGNMENT - Avoid plagiargism and adhere to the spirit of this Academic Honesty Policy.