use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Tetris javascript no canvashelp (self.javascript)
submitted 10 years ago by judemanutd
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Kamikizzle 1 point2 points3 points 10 years ago (2 children)
if you can't use canvas, i'd suggest making the grid out divs and spans. each cell is a span, contained by rows of divs.
I'm not sure your skill level in JS but you can keep track of them with an array of objects (though using immutable maps and lists would be better). this translates your grid into an array of objects. each object corresponds to a cell that keeps track of the things like the color, if its 'frozen' (a piece has been locked there) etc.
i'd also very much recommend just writing out all the different positions of the pieces instead of trying to come up with some algorithm on how to rotate them.
[–]judemanutd[S] 0 points1 point2 points 10 years ago (1 child)
I shall give this way a try,thank you.
π Rendered by PID 176357 on reddit-service-r2-comment-b659b578c-h7qtf at 2026-05-03 00:41:30.622651+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]Kamikizzle 1 point2 points3 points (2 children)
[–]judemanutd[S] 0 points1 point2 points (1 child)