3. Literally speaking


#1

My code is;

var james = {
job: "programmer",
married: false,
speak: function( mood ) {
console.log("Hello, I am feeling " + mood);
}
};

james.speak("great");
james.speak("just okay");

prints out right but it says;

Oops, try again. It looks like your speak method doesn't properly take in a single argument and output the correct string.


#2

Your code works fine. Just refresh your browser or use another browser or copy the code and hit the reset button and paste it in again


#3

tried to refresh code
tried to refresh page
tried another browser (crome and safari)

this section will make me quit javascript. somebody help me.


#4

Yeah. I TOTALLY agree with you. But, as you know, Codecademy is picky. Why? You need to put this:

console.log("Hello, I am feeling" +" "+ mood);

instead of:

console.log("Hello, I am feeling " + mood);

You would probably feel dumbfounded right now, but I don't blame you. I was dumbfounded too. :smiley:

Turns out that in Codecademy, you need to get the spaces perfectly right.


#5

My friend believe me i tried that too again and again.

i added and deleted and added and deleted that + " " + part. my above example is just a moment of my war with this stupid section.

this didnt work too

var james = {
job: "programmer",
married: false,
speak: function( mood ) {
console.log("Hello, I am feeling just" + " " + mood);
}
};

james.speak("great");
james.speak("just okay");


#6

My code:

var james = {
    job: "programmer",
    married: false,
    speak: function(mood) {
        console.log("Hello, I am feeling" +" "+ mood);
    }
};

james.speak("great");
james.speak("just okay");

Also check the spacing. Mine and yours may be different.


#7

this one works. thank you .
accepts '+" "+' instead of '+ " " +' .


#8

Makes me dumbfounded again.:expressionless:
Haha No problem :smiley:


#9

I was dumbfounded when I somehow typed this code in, and it worked :smile:

var james = {
job: "programmer",
married: false,
speak: function(mood) {
if (mood === "great") {
console.log("Hello, I am feeling great");
}
else {
console.log("Hello, I am feeling just okay")
}
}
};

james.speak("great");
james.speak("just okay");


#10

For all the others battling on this make sure the sentence has a capital i
"Hello, I am feeling" will work
"Hello, i am feeling" won't


#11

I thought I was going to spend the whole night trying to do this, but hay look that, i don't have to spend the whole night :), I got the help i need here. You kind people for sharing the knowledge.


#12

you have to changed like this: console.log("Hello, I am feeling " + "" + mood);


#13

I don't agree with that.
I hate adding the whole section just for a space so whenever possible I don't. I add the space into my quotes. My code worked just fine

var james = {
job: "programmer",
married: false,
speak: function(feeling1) {
console.log("Hello, I am feeling " + feeling1);

}

};

james.speak("great");
james.speak("just okay");

You can add the space as its own string or within your existing string (this does not work if you have to functions next to eachother then you have to add the + " " + between them. The trick is just making every other part of the answer identical and not having any code errors.


#14

var james = {
job: "programmer",
married: false,
speak: function( mood ) {
console.log("Hello, I am feeling great");
console.log("Hello, I am feeling just okay");
}
};

james.speak("great");
james.speak("just okay");


i did this after trying so many time, :smile: :smile:


#15

I did a similar if/else statement too which also worked

if (mood === true){
console.log( );
else{
console.log( );
}

but having read this on the forum I have deleted the if/else amended my code to this way instead.


#16

thanks very much really helped


#17

Oh my gosh... this is so very helpful.
We need a list posted somewhere of all of this "Picky" items.
It is hard enough to learn c0de as it is.

thank you!!! thank you!! thank you!!


#18

Codecademy has been an amazing resource on the whole, but items like this are intensely frustrating.

As a rule, I use ("typed string", variable) to add a space, as it saves keystrokes and for me is just my go-to.

The worst is when it prints into the console properly, but that little error box tells you that it's not working xD


#19

Maybe this should be a bug report, but I can't seem to find where you do that. I thought there used to be a "report a bug" button on each page...

I mean in the real world I don't think the computer is going to know the difference between
console.log("Hello, I am feeling " + feeling); and
console.log("Hello, I am feeling" + " " + feeling);


#20

Try This

var james = {
job: "programmer",
married: false,
speak: function speak( mood ) {
console.log("Hello, I am feeling " + mood);
}
};

james.speak("great");
james.speak("just okay");

works perfect

we are going to print the parameter with given string not function,
so use mood instead of string(mood) in console.log

please notice i added manually a space after string "Hello, I am feeling great"
you can do that other way "Hello, I am feeling"+ " " + mood