Returned nan?


Why do i get this?


You're trying to return sidelength * sidelength, and that doesn't exist. Use sideLength (capital L) and it will work.


I always miss those small things!


Common mistake. When you know you make mistakes on this things, you just have to start trying harder to see them. For me, this kind of mistakes are ones I make most often. Wrong variable name, property name, etc. Still it's better than having bad code.