r/learnjavascript • • Sep 28 '26

I built my own mathematics website from scratch.

[removed]

3 Upvotes

4 comments sorted by

1

u/TheRNGuy Sep 30 '26 edited Sep 30 '26

I stead of generating html you could have html file and only add visible or hidden class to them.

Usd code block when posting here (triple ticks)

Better split it to many functions, it will be easier to test.

favoriteIds can be Set.

matchGrade has potential bug because of  !!query and || interaction, where it may always return True when False is expected (I think?)

Start Boolean variables with is, has (hasFoo, isBar, etc)

Add comments to code, Make some expressions shorter (better have more lines but more readable code)

Add caching.

1

u/[deleted] Sep 30 '26

[removed] — view removed comment

1

u/TheRNGuy Oct 01 '26

Consider learning TypeScript for such complex program.