Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Software Development Software Development
Search Search
Search for:
Tech Support Guy Forums > > >

Solved: Learning JavaScript coding, whats wrong with this code?


(!)

ckphilli's Avatar
ckphilli   (Chris) ckphilli is offline
Member with 3,971 posts.
 
Join Date: Apr 2006
Location: Down South
Experience: Intermediate
19-Jun-2012, 03:37 PM #16
Yes, the last 2 curly braces and the comment (//blah blah...fill in here) in between. It's unnecessary.
turbow5's Avatar
Computer Specs
Member with 451 posts.
THREAD STARTER
 
Join Date: Jan 2012
Experience: Intermediate
19-Jun-2012, 03:44 PM #17
Alright Finally it passed me. Any other tips I'm probably going to get stuck on?
ckphilli's Avatar
ckphilli   (Chris) ckphilli is offline
Member with 3,971 posts.
 
Join Date: Apr 2006
Location: Down South
Experience: Intermediate
19-Jun-2012, 03:51 PM #18
I would pay very close attention to curly braces and semicolons (as you've learned already). They can blow up a script in a second and can be a pain.

Also, I would recommend reinforcing your studies by running scripts outside of codeacademy. They do a lot of it for you, and you could benefit from developing a simple html page on your local machine for script testing. I'll let you google that, because you'll learn a lot more that way.

Have fun!
__________________
Security +
turbow5's Avatar
Computer Specs
Member with 451 posts.
THREAD STARTER
 
Join Date: Jan 2012
Experience: Intermediate
19-Jun-2012, 07:29 PM #19
I knew this wouldn't be easy to learn but I don't get what it means by this. Code below.

If("turbow5".length === 9);
do{"I am Wrong"};

It says I'm "missing while". What does that mean?...
ckphilli's Avatar
ckphilli   (Chris) ckphilli is offline
Member with 3,971 posts.
 
Join Date: Apr 2006
Location: Down South
Experience: Intermediate
19-Jun-2012, 10:14 PM #20
Give me another screenshot please, I need to see where you're at in the exercise.
turbow5's Avatar
Computer Specs
Member with 451 posts.
THREAD STARTER
 
Join Date: Jan 2012
Experience: Intermediate
19-Jun-2012, 11:39 PM #21
Says on line 5.
Attached Thumbnails
Solved: Learning JavaScript coding, whats wrong with this code?-javascript-coding-4.png  
ckphilli's Avatar
ckphilli   (Chris) ckphilli is offline
Member with 3,971 posts.
 
Join Date: Apr 2006
Location: Down South
Experience: Intermediate
19-Jun-2012, 11:51 PM #22
Ok turbo, slow down a little bit.

1) forget about the while, that has nothing to do with this.

2) This exercise is no different than the last we helped you with...if{} else {}

3) Remember:

Code:
//this is a comment used as a placeholder or for notes. if you see "//do something" you can't just un-comment and make it work
4) Look at semicolons and curly braces

5) If you look back in this thread, you'll find how to correct your issue.

Good luck, it's bedtime here.
__________________
Security +
turbow5's Avatar
Computer Specs
Member with 451 posts.
THREAD STARTER
 
Join Date: Jan 2012
Experience: Intermediate
20-Jun-2012, 03:29 AM #23
This time I cant figure out what I'm doing wrong. I've visited the Q&A, the first link you showed me and previous post. What is throwing me off?
Attached Thumbnails
Solved: Learning JavaScript coding, whats wrong with this code?-javascript-coding-5.png  
ckphilli's Avatar
ckphilli   (Chris) ckphilli is offline
Member with 3,971 posts.
 
Join Date: Apr 2006
Location: Down South
Experience: Intermediate
20-Jun-2012, 08:27 AM #24
Turbo...semicolons...do not put a semicolon after an if or else.

I just don't think you're thinking about this correctly. Think about a game; a first person shooter. Things happen based on your decisions. You're learning the same thing in a script. For instance:

Code:
IF (you enter a certain room)

{
alert("You shouldn't be in this room");
}

ELSE

{
alert("You're on track");
}
You don't need "do".

These comments include "do" because they are notes and trying to tell you something. Like so:

Code:
IF(8>4)
{
//Do stuff
}
ELSE
{
//Do other stuff
}

IF(8>4)
{
alert("True");
}
ELSE
{
alert("False");
}
These are fundamentals you need to understand before you move forward. Codeacademy is a GREAT learning tool. But don't get caught up in "passing". If you just focus on passing, you aren't going to retain anything.
__________________
Security +
turbow5's Avatar
Computer Specs
Member with 451 posts.
THREAD STARTER
 
Join Date: Jan 2012
Experience: Intermediate
20-Jun-2012, 04:09 PM #25
*brain melting* Am I still missing a semicolon?
Attached Thumbnails
Solved: Learning JavaScript coding, whats wrong with this code?-javascript-coding-6.png  
Ent's Avatar
Ent   (Josiah) Ent is offline Ent is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 4,874 posts.
 
Join Date: Apr 2009
Location: United Kingdom
Experience: Intermediate
20-Jun-2012, 04:21 PM #26
I'm not great at Javascript myself, but I think you want the following:
Remove the DO. Do is a completely different command used for repeating code.

Insert a semicolon just before each of the closing braces, as in the following:
{console.log ("I am right");}
ckphilli's Avatar
ckphilli   (Chris) ckphilli is offline
Member with 3,971 posts.
 
Join Date: Apr 2006
Location: Down South
Experience: Intermediate
20-Jun-2012, 04:23 PM #27
Quote:
Originally Posted by Ent View Post
I'm not great at Javascript myself, but I think you want the following:
Remove the DO. Do is a completely different command used for repeating code.

Insert a semicolon just before each of the closing braces, as in the following:
{console.log ("I am right");}
Yes, thanks Ent. Turbo, read post #24 again. I gave you some perfect examples and said "don't use do".
turbow5's Avatar
Computer Specs
Member with 451 posts.
THREAD STARTER
 
Join Date: Jan 2012
Experience: Intermediate
20-Jun-2012, 07:28 PM #28
Ok got the "do" part but the error is on line 6. It says I did not log the console at all. Isn't that the console.log part?
Ent's Avatar
Ent   (Josiah) Ent is offline Ent is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 4,874 posts.
 
Join Date: Apr 2009
Location: United Kingdom
Experience: Intermediate
21-Jun-2012, 01:35 PM #29
= sets a variable.
== checks whether two variables match.

What's === ?
ckphilli's Avatar
ckphilli   (Chris) ckphilli is offline
Member with 3,971 posts.
 
Join Date: Apr 2006
Location: Down South
Experience: Intermediate
21-Jun-2012, 01:44 PM #30
Quote:
Originally Posted by Ent View Post
= sets a variable.
== checks whether two variables match.

What's === ?
That's the strict equal operator. Both type and value have to be equal to return true.
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


Tags
javascript coding

(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑