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 > > >

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


(!)

turbow5's Avatar
turbow5 turbow5 is offline
Computer Specs
Member with 470 posts.
THREAD STARTER
 
Join Date: Jan 2012
Experience: Intermediate
29-Jun-2012, 12:55 PM #76
Ok got all that done. Think I'm loosing it with this stuff after each lesson. This is how to log the length of the word right?
Attached Thumbnails
Solved: Learning JavaScript coding, whats wrong with this code?-javascript-coding-11.png  
Ent's Avatar
Ent   (Josiah) Ent is offline Ent is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 5,218 posts.
 
Join Date: Apr 2009
Location: United Kingdom
Experience: Intermediate
29-Jun-2012, 01:03 PM #77
You're close. The problem is with line 3. Again, think about the colours. You need to set the value of myJob to the string "Computers".

I should say though, while they may seem useless because the computer doesn't read them, it is very much worth your while using comments that are as descriptive as they can be. They don't cost anything except a moment of time, and it will help you when you or someone else has to come back and read your code some time in the future.
turbow5's Avatar
turbow5 turbow5 is offline
Computer Specs
Member with 470 posts.
THREAD STARTER
 
Join Date: Jan 2012
Experience: Intermediate
29-Jun-2012, 01:40 PM #78
If/then statements again. I don't see what's wrong with the last line.
Attached Thumbnails
Solved: Learning JavaScript coding, whats wrong with this code?-javascript-coding-12.png  
Ent's Avatar
Ent   (Josiah) Ent is offline Ent is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 5,218 posts.
 
Join Date: Apr 2009
Location: United Kingdom
Experience: Intermediate
29-Jun-2012, 01:45 PM #79
Funny how people get all this fancy stuff sorted out, but then forget basic first grade arithmetic.
What is 2 + 2 ?
turbow5's Avatar
turbow5 turbow5 is offline
Computer Specs
Member with 470 posts.
THREAD STARTER
 
Join Date: Jan 2012
Experience: Intermediate
29-Jun-2012, 06:24 PM #80
I wanted a false to be first this time. Does it always have to be true first then false?
Ent's Avatar
Ent   (Josiah) Ent is offline Ent is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 5,218 posts.
 
Join Date: Apr 2009
Location: United Kingdom
Experience: Intermediate
29-Jun-2012, 06:34 PM #81
How do you expect the computer to know that you wanted it to do the first thing if it were false?
Yes, you have to write the true section first.

If someone said "If you have a ticket stand in line A, otherwise stand in line B", that would clearly mean that people who do have tickets take the first option, and people without tickets take the second option. It's exactly the same in this script.
turbow5's Avatar
turbow5 turbow5 is offline
Computer Specs
Member with 470 posts.
THREAD STARTER
 
Join Date: Jan 2012
Experience: Intermediate
30-Jun-2012, 08:27 AM #82
I did not log the correct string to the console... This one stopped me in my tracks. I thought you suppsoe to log them both?
turbow5's Avatar
turbow5 turbow5 is offline
Computer Specs
Member with 470 posts.
THREAD STARTER
 
Join Date: Jan 2012
Experience: Intermediate
30-Jun-2012, 08:28 AM #83
Failed to upload image.
Attached Thumbnails
Solved: Learning JavaScript coding, whats wrong with this code?-javascript-coding-13.png  
Ent's Avatar
Ent   (Josiah) Ent is offline Ent is a Trusted Advisor with special permissions.
Computer Specs
Trusted Advisor with 5,218 posts.
 
Join Date: Apr 2009
Location: United Kingdom
Experience: Intermediate
30-Jun-2012, 08:50 AM #84
I can't see what's wrong there. Sorry.
ckphilli's Avatar
ckphilli   (Chris) ckphilli is offline
Member with 4,210 posts.
 
Join Date: Apr 2006
Location: Down South
Experience: Intermediate
30-Jun-2012, 04:23 PM #85
Don't know Turbo. I just tried it in codeacademy with no problems. Here's what I did:

Code:
if(2+2 > 4)
{
    console.log("test");
}
else
{
    console.log("I finished my first course!");
}
Maybe you have an extra space somewhere? I tried to repeat your error and can't. Regardless, I wouldn't sweat over this...move forward.
turbow5's Avatar
turbow5 turbow5 is offline
Computer Specs
Member with 470 posts.
THREAD STARTER
 
Join Date: Jan 2012
Experience: Intermediate
30-Jun-2012, 06:09 PM #86
I couldn't get it either, I had to copy and paste yours. Am I done with this? there's no next section. If I am done can I start making programs/mods/whatever else?
ckphilli's Avatar
ckphilli   (Chris) ckphilli is offline
Member with 4,210 posts.
 
Join Date: Apr 2006
Location: Down South
Experience: Intermediate
30-Jun-2012, 09:07 PM #87
No, that was just the intro. There are several other JavaScript tutorials on that site.
turbow5's Avatar
turbow5 turbow5 is offline
Computer Specs
Member with 470 posts.
THREAD STARTER
 
Join Date: Jan 2012
Experience: Intermediate
01-Jul-2012, 07:07 AM #88
Yeah after you replied I got a email for a new course.
turbow5's Avatar
turbow5 turbow5 is offline
Computer Specs
Member with 470 posts.
THREAD STARTER
 
Join Date: Jan 2012
Experience: Intermediate
01-Jul-2012, 07:30 PM #89
I'm multitasking to much to look this up at the moment, sorry but when do threads usually close down from no responses?
turbow5's Avatar
turbow5 turbow5 is offline
Computer Specs
Member with 470 posts.
THREAD STARTER
 
Join Date: Jan 2012
Experience: Intermediate
02-Jul-2012, 10:07 PM #90
Never mind I found it. But for the looping part of JavaScript is this how you loop?
Attached Thumbnails
Solved: Learning JavaScript coding, whats wrong with this code?-javascript-coding-14.png  
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 ↑