joshriang
← Back to portfolio

Web & frontend·HTML·Learning project

Triangle Checking

The smallest thing I built while learning the web: type three side lengths and it tells you whether they form a triangle and what kind, equilateral, isosceles, scalene, or not a triangle at all. The logic is two steps, checking the triangle inequality first and then classifying by how many sides are equal. Results update live as you type, which was my first exposure to binding input events to rendering instead of waiting for a button click. It is a beginner exercise and I present it as one, because that is what it is. The value is that it is where I learned a program is a set of rules rather than a page, and everything I have built since is a larger version of the same idea.

Date
2022
Role
Sole developer
Main stack
HTML
Code
github ↗
01
02
  • The triangle inequality needs a strict comparison; equality describes a degenerate line, not a triangle.
  • Live validation means rendering from state on every input event, which is the core of every reactive interface I have written since.
  • Classifying by counting equal sides is shorter and less error-prone than branching on every permutation of sides.
03

Scale 0–100: how much this project relied on each skill.