19.) Failed When sideLength was 0


So my error message is failed when sideLength was 0 wehre it returned NaN instead of 0...not sure what to do in my code to correct it honestly. Do I need some type of if/else to fix it? Seem unlikely though for this particular lesson...

var square = new Object();
square.sideLength = 6;
square.calcPerimeter = function() {
  return this.sideLength * 4;
// help us define an area method here
square.calcArea = function() {
return this.sidelength * this.sidelength };
var p = square.calcPerimeter();
var a = square.calcArea();


uh lots of peeps also have these problems, same here XD

Ok well check the capitalization of sidelength, it should be "sideLength" not "sidelength"

rmb camel code??


Man second lesson in a row that a grammar error gets me haha thanks man! If i get to the lesson your on I will try and help you out as well :smiley:


No worries man :smiley:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.