Help... can't proceed beyond 3/6 keep getting syntax error


#1

Keep getting syntax error whenever I try to print/run code in this section... please advise is this a bug with the page or an error with my code I am confused as I have been stuck on this section for last couple of days and trying everything to get beyond it but nothing seems to be working.


https://www.codecademy.com/courses/learn-javascript/lessons/variables/exercises/create-a-variable-ii?action=lesson_resume


ar myAge = 15;
var likesChocolate = true;


#2

So firstly it may be just because it wasn't copied right but I see your missing a 'v' on your first var.

But I believe the error is coming from the fact that the question is asking you to make a variable called hasPet rather than likesChocolate.
It is confusing though as the example shown is likesChocolate.

Your code should look like this.

var myAge = 15;
var hasPet = true;

console.log(myAge);

console.log(hasPet);

If you are still getting a syntax error let me know.

However if this was the problem please mark my reply as the solution thank you.


#3

Thanks Oscar, the 'v' missing from 'var' was I typo here. I have deleted previous code and copied and pasted your suggested code with variable 'hasPet'... but still getting syntax error code :frowning:


#4

Well that's a bit worrying. There is definitely no syntax errors there. So you deleted all of your previous code and copied mine in? If you did then I'm pretty sure that this is a bug :confused:


#5

@CodecademyModerators is this a bug?


#6

However, first instruction states...

'Under the strength variable, create a new variable named age and set it equal to your age as a number'.

How do I go about presenting this code? I am not sure how to present the 'strength' variable with a 'new' variable named age...

Thanks for your help.


#8

So you present them as separate variables.

Above the code I first mentioned should be this.

var strength = '50,000 pounds';

console.log('How much stuff can a variable hold? ', strength);

#9

All of the code should look like this.

var strength = '50,000 pounds';

console.log('How much stuff can a variable hold? ', strength);

var myAge = 15;

console.log(myAge);

var hasPet = true;

console.log(hasPet);

#10

Thanks Oscar, I tried this too but still same issue... see below, thanks.


#11


#12

Copy and paste just this bit of code below. Then do what you just did and show the result. I really wan't to get to the bottom of this.

var strength = '50,000 pounds';

console.log('How much stuff can a variable hold? ', strength);

var myAge = 15;

#13

Wait actually just this.

var strength = '50,000 pounds';

console.log('How much stuff can a variable hold? ', strength);

var age = 15;

#14

Thanks, I have just done that. Please see below...


#15

Must be a bug. Should wait to see what a moderator says.


#16

Thanks for your time, much appreciated, cheers.


#17

var strength = "50,000 pounds";
console.log("How much stuff can a variable hold?", strength);
var age = 13;
console.log(age);
var hasPet = true;
console.log(hasPet);

This code works for me.


#18

Thanks... yes, I am getting the syntax error with this too.


#19

What browser are you using?


#20

I am using Chrome...


#21

Try a different browser, codecademy hasn't been working well on Chrome recently.