What


#1

Continuing the discussion from Whats wrong with my code?:


Replace this line with your code.

var myOwnObject ={};
myOwnObject.name="Anish"
myOwnObject.number='9491479223';
myOwnObject.age = 23;
myOwnObject.details =function(){
console.log("MyDetails :"+""+this.name="Anish"+""+this.number=9491479223+" "+this.age=23);
};
myOwnObject.details();


#2

Those methods have already been defined.

Do:

this.age, this.name and this.number.

console.log("MyDetails :"+""+this.name+""+this.number+" "+this.age);

#3

Add a semicolon after myOwnObject.name="Anish"

Did you want this numeric literal to be a string?

myOwnObject.number='9491479223';

Modify this.

myOwnObject.details =function(){
console.log("MyDetails :"+""+this.name="Anish"+""+this.number=9491479223+" "+this.age=23);
};

You don't have to reinitialize your key-value pairs to Anish, 94914..., and 23 because you've already initialized those values. We simply need to call the object and get it's values from it's different properties. Which will look like this:

myOwnObject.details =function(){
console.log("My details: "+this.name+" "+this.number+" "+this.age);
};
myOwnObject.details();

#4

thank you..!
I have another probelm in mycode.. can u check plz..

var movie=prompt("movie review list: Toy story2,finding nemo,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";
break;
case 'The Lion King':
return "Greet songs.";
break;
default :
return "I don't know!";
break;
}
};
getReview(movie);

Error: Oops, try again. Check the review of Toy Story 2


#5

It would have been better to start another thread. Be that as it may, the issue should be here.

The instruction says:

"Toy Story 2" - "Great story. Mean prospector."

You weren't exact in the return string. See full code below.

var getReview = function (movie) {
switch(movie) {
    case "Toy Story 2":
        return "Great story. Mean prospector."
        break;
    
    case "Finding Nemo":
        return "Cool animation, and funny turtles."
        break;
        
    case "The Lion King":
        return "Great songs."
        break;
        default:
        return "I don't know"
}
        
};

#6

thank you..:slight_smile:


#7

You're welcome.

Have fun coding! :slight_smile:


#8

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