Asking for Feedback...again


#1

Hi! I have been stuck at the Asking for Feedback problem for about 2 weeks now. I have changed to a different browser and emptied my cache and picked through my code. I just want to move on, but here I am. Any other suggestions that can move me out of Bieber's concert already?!

console.log ( "Are you ready to play?" );
confirm ( "Yes! Here we go!" );
var age= prompt ( "What's your age" );
if (age<13)
{console.log( "You can play, but I am not responsible." );
}
else
{console.log( "Let's do this!" );
}
console.log ( "You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.' " );
console.log ( "Suddenly, Bieber stops and says, 'Who wants to race me?' );
var userAnswer= prompt ( "Do you want to race Bieber on stage?" );
if (userAnswer==="yes")
{console.log ( "You and Bieber start racing. 'It's neck and neck! You win by a shoelace!' " );
}
else
{console.log ( "Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.' " );
}
var feedback= prompt ( "Please rate this game 1 through 10." );
if (feedback>8)
{ console.log ( "Thank you! We should race at the next concert!" );
}
else
{ console.log ( "I'll keep practicing coding and racing." );
}


#2

In

console.log ( "Suddenly, Bieber stops and says, 'Who wants to race me?' );

you are missing an ending-double-quote-"
like

console.log ( "Suddenly, Bieber stops and says, 'Who wants to race me?' ");

After correction i tried your code in a windows 8.1 IE11 environment and got a pass..


#3

Thank you! Now I am stuck on Function Syntax. Here is my code, attempting to use the greeting function, with no luck.

var greeting = function (name) {
console.log("Great to see you," + " " + name);
};

// On line 11, call the greeting function!
var greeting = function ( name ) {
console.log ( "Great to see you," + " " + Jana );
};


#4

@jbrownbear,

the FUNCTION talk

var myFunc = function( param1, param2) {
       //Begin of  anonymous FUNCTION-BODY
       //VARIABLE -myFunc- has an -anonymous function- assigned
       //this -anonymous function- has 2 PARAMETERS param1 and param2
       //param1 and param2 PARAMETERS are used 
       //as -local- VARIABLES throughout the FUNCTION-BODY

      console.log( param1 + " and " + param2 ) ;

      //End of anonymous FUNCTION-BODY
};

If you want to call/execute the anonymous function
you will have to add a pair of parentheses to the variable myFunc
like
myFunc();
As the anonymous function was defined
as having 2 parameters
you have to provide 2 arguments
in our case 2 string VALUES "Alena" and "Lauren"
like
myFunc("Alena","Lauren");

some quotes from the outer-world:

**argument is the value/variable/reference being passed in,
parameter is the receiving variable used within the function/block**

OR

**"parameters" are called "formal parameters",
while "arguments" are called "actual parameters".**


#5

@jbrownbear,

++++ function with 1 parameter using return-statement

var myFunction = function( param1 ) {
       //Begin of FUNCTION-BODY
       //myFunction =function= has 1 PARAMETER param1
       //this param1 PARAMETER is used as a -local- VARIABLE
       //throughout the FUNCTION-BODY

      return param1;

      //End of FUNCTION-BODY
      };

you have defined a myFunction function
which takes 1 parameter param1
this param1 parameter is used
as a variable throughout the FUNCTION-BODY.

If you want to call/execute this myFunction function
and this myFunction function was defined
as having 1 parameter param1
you will have to provide 1 argument
in our case a "number VALUE" 4
myFunction( 4 );

some quotes from the outer-world:

**argument is the value/variable/reference being passed in,
parameter is the receiving variable used within the function/block**

OR

**"parameters" are called "formal parameters",
while "arguments" are called "actual parameters".**

============================================

As you are using the return-statement in your myFunction function
you will only get a return-value no-display.
You can however capture this return-value in a variable
and then use the console.log()-method to do a display.

var theResult = myFunction( 4 );
console.log( theResult );

OR directly

console.log( myFunction( 4 ) );

#6

Ok... I am trying to follow what you are saying. I think you mean that I have the wrong value? with my function? I thought I was using the same recipe I saw in the example listed, just plugging in different values. Somehow, I am a little more confused about EXACTLY what I should put in the parentheses?


#7

@jbrownbear,
With

var greeting = function (name) {
        //Begin of FUNCTION-BODY

        console.log("Great to see you," + " " + name);

        //End of FUNCTION-BODY
};

you have created a greeting variable to which you assign
a so-called anonymous Function.
This _anonymous Function takes 1 parameter name
This name parameter is used as a =local= variable
throughout the FUNCTION-BODY of the anonymous Function

Now if you call this anonymous Function
greeting()
and this anonymous Function** was defined as having 1 parameter _name
you will have to provide 1 argument
in our case that would be the string Value "Jana"

greeting("Jana");

some quotes from the outer-world:

**argument is the value/variable/reference being passed in,
parameter is the receiving variable used within the function/block**

OR

**"parameters" are called "formal parameters",
while "arguments" are called "actual parameters".**


#8

Hi. I'm getting frustrated here because I would really like to use this for one of my classes. I keep getting an error message after completing the last lines of code (see below):

// Check if the user is ready to play!
confirm("I am ready to play");
var age = prompt("What's your age");
if (age<13)
{
console.log("Play at your own risk");
}
else
{
console.log("Play on!");
}
console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'");
console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'");
var userAnswer = prompt("Do you want to race Bieber on stage?");
if (userAnswer =="yes")
{
console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!");
}
else
{
console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");
}
var feedback = prompt("Rate my game out of 10");
if (feedback > 8)
{
console.log("Thank you! We should race at the next concert!");
}
else
{
console.log("I'll keep practicing code and racing.");
}


#9

@lynnemichaud,

-01.
Create a variable called feedback and prompt the user to rate your game out of 10.

-02.
If feedback is greater than 8, print out:

"Thank you! We should race at the next concert!"

-03.
Otherwise, print out:

"I'll keep practicing coding and racing."


#10

Ok... I plugged in my name, but I am still being told that I did not call the greeting function. Here is my code.

var greeting = function (Jana) {
console.log("Great to see you," + " " + "Jana");
};

I thought I plugged in the correct values, but it still says I didn't call it. Thank you for being patient with me; I find that the answers seem easiest when I actually know them!


#11

@jbrownbear,
did you read
= http://discuss.codecademy.com/t/asking-for-feedback-again/7846/7?u=leonhard_wettengmx_n


#12

Lol I did. And it's simpler than I thought it was! Thank you again for helping.