| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Week 1

Page history last edited by Shana L. McDanold 12 years, 2 months ago

Week 1 Session

 

Summary: Learning to program lesson (using Javascript), build FizzBuzz (Javascript program)

 

Questions


  • Question posted on my blog: "I just managed to accidentally create an endless loop in the "scratch pad" while working on Lesson 7, exercise 4. Had to hit ctrl-alt-del to pull up the Windows task manager and shut down the web browser. Is there an easier way to kill runaway programs?"
    • Response via Twitter (@ostephens): "from some searching around there isn't a good solution. Use chrome and you can kill the tab rather than browser"

 

  • Naomi asks: I feel like a moron, but what IS the syntax for lesson 6 exercise 4?? if line 5 isn't

          ) else if (number ==="6") (

          then I dunno what! Ideas?

 

  • Doreva asks: I love the idea for this project, but I'm having a lot of trouble with the webpages freezing up in both Firefox and Chrome. Clearing cache and rebooting has not helped. Any ideas?

 

Discussion/observations


Half way through, things I've noticed - SPELLING and PUNCTUATION are critical and likely to make me tear my hair out. --Shana

 

Comments (18)

Bill Anderson said

at 9:25 am on Jan 11, 2012

Yup, just started at square 1, but I know from my priorforays (brief viking raids?) into programming how picky parsers can be. One misplaced (or as is often the case, missing) character can jam up the whole plumbing. Keeping track of opening and closing parenthesis, brackets, angle brackets or what have you can be challenging, especially if you have multiple statements nested within in each other. Even when the parser tells you in what line the problem is.

Yup all that fuss with ISBD and ending punction in MARC, which drove me up a wall back when first learning MARC should put everybody in the right mindset :)

Christine DeZelar-Tiedman said

at 2:06 pm on Jan 11, 2012

An added problem for me is that I have a very hard time seeing the difference between the parentheses and brackets. I understand the different uses, but thy look almost identical to my eyes. Really tripped me up in lesson 6.7. I tried adjusting my screen resolution but it didn't help. Anyone else have this problem and find a solution, or do I just need bifocals?

ThatAndromeda said

at 7:14 am on Jan 13, 2012

Note that the editor is coloring them for you -- if you move your cursor to a parenthesis or bracket it'll be highlighted in red (if it isn't closed properly) or in ...I think blue...along with its matching parenthesis/bracket. This will let you see if you've closed them properly, and what the *computer* thinks a set of parentheses encloses (may or may not be what you WANT them to enclose ;). Syntax coloring = invaluable.

byoose said

at 3:46 pm on Jan 11, 2012

RE: infinite loop - in most terminals you can do control-c to cancel actions. I haven't tried it on the scratch pad though...

amethystmenace@gmail.com said

at 10:22 am on Jan 12, 2012

Speaking of infinite loops, I'm liking that I can run through a lesson over and over and over until I feel I've actually GOT it.

amethystmenace@gmail.com said

at 10:53 am on Jan 12, 2012

Christine, if you use Ctrl+ to make everything bigger, does that help?

Christine DeZelar-Tiedman said

at 2:04 pm on Jan 12, 2012

I'll try that; thanks.

Bill Anderson said

at 1:38 pm on Jan 12, 2012

Something funny going on with typing space to the right of the lesson. It seems to have shrunk to one line and won't take typing. I'm using Goggle Chrome for my browser and it was just working yesterday. Anybody run into this?

Steve Early said

at 2:18 pm on Jan 12, 2012

Did anyone complete FizzBuzz Exercise 4 using the method that was suggested in the hint? I figured out the "principal" of the hint (I had no syntax errors), but I couldn't get the program to execute correctly. Instead, I "passed" the full lesson by using a different method (and probably not the one they wanted). (I'm not going into details so as to avoid "spoilers": if you want to respond here, a simple "yes" or "no" will suffice).

Owen Stephens said

at 5:42 am on Jan 13, 2012

There is always more than one way to achieve something in code, and although it sometimes matters which you choose (some methods might take less memory, or time, or just be more aesthetically pleasing!), for this kind of exercise I don't really think it matters - if it works, then it's all good.

I did get it working by using the hint provided, but I'm not sure that's the approach I'd take naturally - I think they use this approach because it means you can complete the exercise without introducing any new concepts.

ThatAndromeda said

at 7:16 am on Jan 13, 2012

Maybe we should have a spoiler-friendly space where people CAN post code? It's really hard to give feedback on why code might not be working without actually seeing the code.

Owen Stephens said

at 7:19 am on Jan 13, 2012

I've added a 'Questions' section under this week, and also added a 'Question' template that people can use when creating a new question - hope this is OK (may have mucked up a little bit - seem to have created some redundant pages that I can't delete

Jenny Wright said

at 2:32 pm on Jan 12, 2012

I had exactly same as you Steve. I do find the codecademy lessons a wee bit frustrating from this point of view :(

Steve Early said

at 2:50 pm on Jan 12, 2012

Naomi: looks like you put parentheses at the beginning and end when you should have put brackets:

} else if (number === "6") {

amethystmenace@gmail.com said

at 11:16 am on Jan 13, 2012

Aha! So I need to take my own advice about a large-print screen! Thank you!

Bryan Campbell said

at 6:38 am on Jan 16, 2012

I wish the function of '+" had been explained explicitly at the outset. When I first saw it in 'console.log("i is now equal to " + i);' I mistakenly thought it had something to do with iteration. If there was an explanation, I missed it.

Owen Stephens said

at 9:14 am on Jan 16, 2012

This is confusing - and part of the issue is that the '+' operator serves different functions depending on the 'type' of thing you 'add' together using '+'. Examples:

Add two numbers together:
6 + 6;
Will give the response '12' because when javascript applies the '+' operator to two numbers it does what you expect it to do and adds them together

Add two strings together:
"Hello " + "World";
Will gives the response 'Hello World' because when javascript applies the '+' operator to two strings it concatenates the two strings together

Add a string and a number together:
"Hello " + 6;
Will give the response "Hello 6" because when javascript applies the '+' operator to a string and a number it converts the number into a string and concatenates the two strings together

Gotcha:
"6" + "6";
Will give the response "66" because by putting the inverted commas around the numbers you've actually converted them to a string and they are treated as such.

So be aware that:
var i = 1; is different to var i = "1"; but that
"Hello " + i; would give an output of 'Hello 1' in both cases :)

Rick Fitzgerald said

at 11:14 am on Jan 17, 2012

Just realizing that the reply "Oops, try again" doesn't indicate a coding error - only that it doesn't pertain to the exercise. That's good to know.

You don't have permission to comment on this page.