This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by Yellowben
over 9 years

Java , 27/28

Hi guys , Can you tell me what is wrong with this code below please ?

var maCouleur =”Bleu”; console.log(maCouleur.length);

Thx

Answer 5456409e7c82ca9ee2004bfa

0 votes

Permalink

Thanks for answer , but it is still not working ..

points
Submitted by Yellowben
over 9 years

Answer 5456fa4a7c82ca08760070e6

0 votes

Permalink

var maCouleur ="Bleu";
console.log(maCouleur.length);

your code is perfectly fine assuming that the instructions ask for the variable to be called maCouleur

I don’t know if there’s a French version for all the exercises by my exercise asks for the variable to be called myColor

points
Submitted by Neil
over 9 years

Answer 545765377c82ca5c36007dd0

0 votes

Permalink

Hi,

I’ve exactly same problem… my code is refused even it works correctly (result in console is correct) ! message is : Oups, merci de réessayer. On dirait que vous n'affichez pas la longueur de maCouleur dans la console !

// Sur la ligne 2, écrivez votre premier commentaire; ça peut être n'importe quoi !
// hjhjhjkh
maCouleur="rouge";
console.log( maCouleur.length );

If I go to this page : http://www.codecademy.com/courses/getting-started-v2/4/4 which is same exercise in english, code is OK ! I’ve try to use myColor instead of maCouleur but it doesn’t work.

I’ve also try this code with same problem:

// Sur la ligne 2, écrivez votre premier commentaire; ça peut être n'importe quoi !
// hjhjhjkh
maCouleur="rouge";
maCouleur.length;

I’m French using Fedora 20 and Firefox (I’ve same problem using Chrome).

Regards.

points
Submitted by Lafaille
over 9 years

Answer 54553be8282ae30b940029ba

-1 votes

Permalink

put quotes around macouleur

points
over 9 years

1 comments

Neil over 9 years

No. NEVER put quotes around a variable’s name.

Answer 545663377c82ca4ec100519d

-1 votes

Permalink

var maCouleur =”Bleu”; console.log(“4”);

points
Submitted by AnonAlex
over 9 years

1 comments

Neil over 9 years

You do not hard code the number. The point of coding is to make the computer do the work for you. You need to use the variable and .length to do that.

Answer 5456935c7c82ca1526005cc1

-1 votes

Permalink

Here is the final source…

var myColor = "blue";
console.log("blue".length);
points
over 9 years

1 comments

Neil over 9 years

No. You do not retype the string a second time. You always use the variable otherwise what’s the point in declaring it in the first place!