Hacking My (Dot) Life

Beginning JavaScript

I haven’t coded as much as I’d wanted to in the past few days.  Work, getting sick, family members getting sick made it hard to really sit down and just focus.  It took me a few days to complete the first 2 lesson in the Introduction to Javascript section from Codecademy.  This first lesson contained 28 parts. the second section only 7.

Aside from illness and distractions, It was hard for me to understand and comprehend what I was learning throughout the first lesson.

The first lesson makes you just jump in.  It starts showing you little tricks and what Javascript is all about.  You can do simple math in/within/with the console (which is, I’m assuming, Javascript itself.  But writing random words, the example they used being “eggplant”, won’t work and will give you an error message, as it’s not part of the Javascript language.

I also learned about “confirm” and “prompt”.  To describe a “Confirm”, the best example I can think of is when you are in the middle of typing a message or status update on Facebook and you don’t send it and you try to navigate from the page and you get a message asking if you’re sure you want to navigate away.  You either press “OK” or “cancel”.

Prompt is when a little box pops up and… wait… as I’m writing this, I feel like a prompt is very similar to a Confirm.  A prompt is an interactive box, asking for input.  Similar to when you go on certain sites and a box pops up and asks “what’s your age” and you have to enter your age. You have to input information and dependent on what you enter, the next step happens.

I then learned there are different types of data:

  • Numbers– you guessed it, 123456, etc.  you use them for math.
  • Strings– words, spaces, letters a-z and even numbers.
  • Booleans– Can only determine true or false statements.

The thing with strings , you need to put them in quotation marks.  you don’t with numbers.  Booleans you use with If/Else statements.

I then learned about console.log which is the syntax to printout, or make it seen on the screen, what you want the viewer to see.

Next came If/Else statements.  Despite the fact that most of the plans revolve around the If/Else statements I was just.not.getting.it.  Maybe it was because I was sick, or because I was distracted and did this unit so slowly and doing an exercise or two and not coding for a day or more until the next time I came to it.  It sucked.  I kept having to go back and review what I had previously done.  I had to reread instructions and at one point I redid OLD lessons just to get back into the rhythm of things.  I felt so lost I just figured I wouldn’t have the abilities to do more than just front-end design.  Was I destined to just know HTML/CSS?

if_else

I’m not going to lie, I kind of just went through the motions of the lessons and all the while in the back of my head I just kept asking myself “What IS this?  How does this fit into the scheme of things? am I EVER going to understand this? WTF?!?!”  I just kept hoping that somewhere along the way something would just click and the clouds would part and I could see and understand exactly what was happening.

That breakthrough sort of happened in Lesson 2.  Lesson 2 uses most of what you learned in the previous lesson and you design a “Choose Your own Adventure” game.  In the game Batman needs to go shopping and you use variable, if/else statements to navigate the game.  It’s really cute and that’s where you can sort of understand the Why’s and How’s:  why you have to define variables, Why and How console.log REALLY work together with the If/Else statements.  I loved it.

ChooseAdventre

I don’t think I had this much trouble with the HTML/CSS lessons because I already understood what they were, and I had done HTML in the past.   With Javascript, I threw myself in and I didn’t even know what  exactly Javascript is.  I wasn’t exactly sure what Javascript did or in what ways it was “interactive”.  I still don’t fully know all of Javascript’s potential or even looking at a site if what I am looking at contains Javascript but, I guess that’s what this learning thing is all about.

I liked the beginner lesson.  The only thing I would suggest would be for a definition other than “Javascript is interactive”.  That doesn’t mean ANYTHING to someone who has no idea what it IS.  Also, I wish the lesson was a bit more linear. It felt like we learned string and numbers and then Booleans and then went back to math.  I think I may just be a bit finicky and might just be that i have a different learning style. It finally clicked, so I guess it’s not a big deal.  The website was a bit buggy with a few exercises and I had to open a new window and paste my code in order for things to go through.  Very frustrating and prior to finding out I had to do this I lost 2 hours thinking my code was incorrect.  I’m so thankful for the Q&A forums, if not I might still be trying to find an error.  Another thing I wish I knew and might just have to research and maybe learn this elsewhere is: Is there a CORRECT way/standard to lay out your code so that it’s neat and legible?

Leave a Reply

Your email address will not be published. Required fields are marked *