Monday, January 20, 2014

New Font New Lessons

     Well, I'm at the coffee shop. I wasn't planning on going here, but the internet is down. I mean really down! the line got cut somewhere between our neighbor's house and our house. So, the company is going to be digging around fixing all of that for a while. So, here I am getting stuff done and having a good lattĂ©. I got a little sidetracked by some questions about my Chromebook Pixel, and it does cut quite the figure, so I can understand people asking about it. I'm back on track now. The music for today is: The Crystal Method. I'm not really sure how I came across it, but I put in my Google Play Music a bit ago, and voilĂ ! Cool music! I'll probably throw some Pink Floyd in there too. The radios are just playing their two most popular songs according to them: Another Brick In The Wall, and Wish You Were Here. It makes me want to hear more than just those two, but enough chatter! Time to plug in and plug away!

     Today, the lessons are starting out with arrays. From some Googling and just general info received from people, I know that arrays are going to be very useful. So, I need to keep my head up.

     Yay! Loops and arrays! Check it out:
// Let's print out every element of an array using a for loop

var cities = ["Colorado", "The Grand Canyon", "A lot of Europe", "NYC because Gotta go at least once, I suppose.", "Japan", "Damn Yankee States", "New Orleans"];

for (var i = 0; i < cities.length; i++) {
    console.log("I would like to visit " + cities[i]);
}

It kind of had me there for a bit until I realized they weren't trying to print numbers, they were printing the elements in the array and calling them in order by number.
I added in the elements in the array. As you can see, I want to visit a profuse amount of places. Of course, this isn't an exhaustive list.
     Wow. These people don't even remember what they are saying! They said, and I quote: "Remember, arrays use zero-based indexing!" The Image they show with it? <var arrayName=[1, 2, 3];> Um... no! That is NOT zero-based indexing! This is: <var arrayName = [0, 1, 2];> Duh. It's not like they don't know this! I learned what zero-based indexing is from them; they just can't show their work correctly all the time. Also, it would seem I should have known that if I have a <for> loop, you just run it. You don't need to print it to the console. I noticed that it was printing out the array in order going down, and then having it inside the brackets with the quotes and everything. I knew it shouldn't print twice, so I checked the forum, and they were all just running it. Well, now I know that too! 

     I always forget to put a space at the end of the quotes when it is concatenated with anything else. I better get that under control. Creating code with a solid simplicity also needs to be correct, of course. So, I better work on that. Don't want to get a job somewhere and then start doing crap code, do I? Of course not.

Today has been a win for me, I got a lot done, learned a lot of useful stuff, there was only a little bit of stupid. Winning! See y'all Wednesday!

--Martin