Jump to content

Codecademy

BustinJustin

Anybody used it? I think it's actually pretty good for teaching.  I haven't made my way to their more in-depth stuff so I don't know how advanced they get.

 

I've been using it to refresh on JavaScript. I got to one "assignment" and it keeps telling me that I have an error. Can you find it? I can't:

var creditCheck = function(income){     if(income >= 100){           console.log("You earn a lot of money! You qualify for a credit card.");     }     else{            console.log("Alas yo do not qualify for a credit card.  Capitalism is cruel like that.");     }};creditCheck(75);

The instructions are:

  1. Write a function called creditCheck that takes the parameter income.
  2. Inside the function, write an if statement where if the income is greater than or equal to 100, the computer will return "You earn a lot of money! You qualify for a credit card."
  3. If the income is less than 100, have the computer return "Alas you do not qualify for a credit card. Capitalism is cruel like that."
  4. Call the function passing in an income of 75
  5. AFTER you call it with 75, call it with 125
  6. AFTER you call it with 125, call it with 100. Have to be sure!

 

 

I get the error: "Oops, try again! It looks like your function doesn't return 'Alas you do not qualify for a credit card. Capitalism is cruel like that.' when the income argument is 75."

 

Am I doing something wrong or is the site derping?

If it can mean anything to anybody at any time, it means nothing.

Link to comment
Share on other sites

Link to post
Share on other sites

Wich exrecise is it exacly? Wich number? I have done that exrecise but i can't find it but if i find it i could give you my code

[CPU: AMD FX-6100 @3.3GHz ] [MoBo: Asrock 970 Extreme4] [GPU: Gigabyte 770 OC ] [RAM: 8GB] [sSD: 64gb for OS] [PSU: 550Watt Be Quiet!] [HDD: 1TB] [CPU cooler: Be Quiet! Shadow Rock Pro Sr1]  -Did i solve your question/problem? Please click 'Marked Solved'-

Link to comment
Share on other sites

Link to post
Share on other sites

Introduction to functions 12/13

If it can mean anything to anybody at any time, it means nothing.

Link to comment
Share on other sites

Link to post
Share on other sites

This is my code: 

var creditCheck = function(income){if(income >= 100){return "You earn a lot of money! You qualify for a credit card.";} else {return "Alas you do not qualify for a credit card. Capitalism is cruel like that.";}};console.log(creditCheck(75));console.log(creditCheck(125));console.log(creditCheck(100));

I think the thing you did wrong was not console log but i don't know for sure but feel free to copy and paste my code! :)

[CPU: AMD FX-6100 @3.3GHz ] [MoBo: Asrock 970 Extreme4] [GPU: Gigabyte 770 OC ] [RAM: 8GB] [sSD: 64gb for OS] [PSU: 550Watt Be Quiet!] [HDD: 1TB] [CPU cooler: Be Quiet! Shadow Rock Pro Sr1]  -Did i solve your question/problem? Please click 'Marked Solved'-

Link to comment
Share on other sites

Link to post
Share on other sites

I tried the console log and I still got the error. Then I copied and pasted your code and it worked!

 

I have no idea what I did wrong but thanks for the help!

If it can mean anything to anybody at any time, it means nothing.

Link to comment
Share on other sites

Link to post
Share on other sites

do else have to be inside if? so one tab to the left. try it, but i dont speak C so i cant say :P

Link to comment
Share on other sites

Link to post
Share on other sites

It's doing it again. I think the problem is that for some reason it's logging the reply twice.

 

eiHMksX.jpg

If it can mean anything to anybody at any time, it means nothing.

Link to comment
Share on other sites

Link to post
Share on other sites

On the first example I believe he was complaining about the string not being exactly what was expected.

You had "Alas yo do not qualify for a credit card. Capitalism is cruel like that."

 

On the second example I'd say he's complaining because you are logging the string instead of actually returning it.

Link to comment
Share on other sites

Link to post
Share on other sites

In the first assignment you didn't copy the exact phrase they wanted you to return.. You also have to use 

return "phrase";

 not 

console.log("phrase");

In the second assignment you will also use return..

CPU: i7 4770k | GPU: Sapphire 290 Tri-X OC | RAM: Corsair Vengeance LP 2x8GB | MTB: GA-Z87X-UD5HCOOLER: Noctua NH-D14 | PSU: Corsair 760i | CASE: Corsair 550D | DISPLAY:  BenQ XL2420TE


Firestrike scores - Graphics: 10781 Physics: 9448 Combined: 4289


"Nvidia, Fuck you" - Linus Torvald

Link to comment
Share on other sites

Link to post
Share on other sites

  • 3 weeks later...

It's doing it again. I think the problem is that for some reason it's logging the reply twice.

Posted Image

Ahhh I can't stand that java style line breaking. C style is so much nicer
Link to comment
Share on other sites

Link to post
Share on other sites

Ahhh I can't stand that java style line breaking. C style is so much nicer

What?

 

This looks like Javascript, not Java. And what line breaking?

Link to comment
Share on other sites

Link to post
Share on other sites

sorry for the thread hijacking but i'm stuck on this level in html and i dont want to start a whole new thread for another codeacademy problem!

 

Codeacademy is telling me to basically make an image be a certain height and have the border with the given requirements:

  1. Give your tds a border of 1px dashed blue.
td{    height:50px;    border: 1px dashed blue;} 

^this is what i have in my css file but i get an error saying i haven't put the border as 1px wide, any ideas why? Thanks

Delltopia

Case & Mobo: Stock Dell Optiplex 7010, CPU: i5 3470, RAM: 16gb 1333 DDR3 (1x8gb Corsair Vengence, 2x4gb Random), GPU: Diamond Radeon HD 7970,

PSU: EVGA GQ 650W, SSD: Kingston v300 128gb (OS), HDD: 700gb Seagate 7200rpm (Storage)

Link to comment
Share on other sites

Link to post
Share on other sites

sorry for the thread hijacking but i'm stuck on this level in html and i dont want to start a whole new thread for another codeacademy problem!

 

Codeacademy is telling me to basically make an image be a certain height and have the border with the given requirements:

  1. Give your tds a border of 1px dashed blue.
td{    height:50px;    border: 1px dashed blue;} 

^this is what i have in my css file but i get an error saying i haven't put the border as 1px wide, any ideas why? Thanks

That td selector code should work. How are you using the css? Inline, header, or external file?  In VS 2012 Pro with intellisense automatic code writing, this code was generated

 

The no space between the :5 shouldn't effect the code from running the right way. Might want to to look at the space between td{

td {    border: 1px dotted blue;    height: 50px;}

Michael Summers

CaseObsidian 900D  MOBORampage IV Extreme CPU:  i7-4960X Ivy Bridge-E 3.6GHz  RAM:: Vengeance Pro 32GB  Boot : RAID 0  840 Pro  512GB  Data:  RAID 10 WD Red  2TB PS: Corsair : AX1200 GPU:  ASUS  GTX-780 Ti

Birthday Gift from my wife - She made me order it and built it :-)

Link to comment
Share on other sites

Link to post
Share on other sites

What?

 

This looks like Javascript, not Java. And what line breaking?

if you see *.js it's JavaScript. The screenshot clearly shows script.js.

 

I never thought about creating a javascript paper, rock, and scissors game. Just add graphics and you good to go. I read the thread kind of fast.  Don't know that you trying to do. I know that you will get the same results because line 1 to 9 is commented out.

 

I use document.write("Some text"); over console.log because I'm a website developer & Designer by trade.

Michael Summers

CaseObsidian 900D  MOBORampage IV Extreme CPU:  i7-4960X Ivy Bridge-E 3.6GHz  RAM:: Vengeance Pro 32GB  Boot : RAID 0  840 Pro  512GB  Data:  RAID 10 WD Red  2TB PS: Corsair : AX1200 GPU:  ASUS  GTX-780 Ti

Birthday Gift from my wife - She made me order it and built it :-)

Link to comment
Share on other sites

Link to post
Share on other sites

if you see *.js it's JavaScript. The screenshot clearly shows script.js.

 

I never thought about creating a javascript paper, rock, and scissors game. Just add graphics and you good to go. I read the thread kind of fast.  Don't know that you trying to do. I know that you will get the same results because line 1 to 9 is commented out.

 

I use document.write("Some text"); over console.log because I'm a website developer & Designer by trade.

I wasnt replying to you.

Link to comment
Share on other sites

Link to post
Share on other sites

I recommend using hourofcode.com its by code academy but kinda better and more fun.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×