What is wrong with this code, Your method failed when sideLength was 0 where it returned NaN instead of 0
You need to see these snaps that I observed and I will also give you reason why your code throwing Error.
Lets see what question is asking?
Now lets observe your code!
You mistakenly wrote
sideLength as sidelength !
If it solves your problem ,let me know!
If not , I'll glad to help! do ask!
Mystery of NaN type--
Read about NaN