More kinds of Methods


Whats wrong with my code.
The error tells me that “Oops, try again. Your method failed when sideLength was 0 where it returned NaN instead of 0”

var square = new Object();
square.sideLength = 6;
square.calcPerimeter = function() {
return this.sideLength * 4;
square.calcArea = function() {
return this.sidelength * this.sidelength;

var p = square.calcPerimeter();
var a = square.calcArea();


Hi here

return this.sidelength * this.sidelength;

You should use this.sideLength instead of this.sidelength


Thank you, It worked


I stucked in Introduction to objects section 13 chapter function reveiw.
can any one help, wats wrong in my code

var square = function (x) {
return x * x;

var mulitply = function(x,y) {// Write the function multiply below
return x * y;
};// It should take two parameters and return the product


HI when you call the function multiply you should put two number inside it

//It should take two parameters and return the product

then here

var mulitply = function(x,y)

you wrote mulitply instead of multiply


Thank you so much sir, i have seen all the topics in all chapter, for all problem u solve it nicely.


Can you tell me what is wrong in this code? i’m getting SyntaxError: Unexpected token return

var answer = prompt(“Toy Story 2,Finding Nemo,or The Lion King”)
var getReview = function (movie) {

switch (movie) {
case “Toy Story 2”,
return “Great story.Mean prospector.”;
case “Finding Nemo”,
return “Cool animation, and funny turtles.”;
case “The Lion King”,
return “Great songs.”;
return “I don’t know!.”,


Hi your case condition should end with a : like that …

case "Toy Story 2":
case "Finding Nemo":


Still its showing warning like this Oops, try again. Check the review of Toy Story 2
but i’m getting output.


you should copy the exacte review they gave in the lesson

I didn’t notice that but next time it’s better if you create a new topic…


Ya i got it thank you so much