pineapple.jpg

Blog

Reading through Learning JavaScript: Third Edition

This past week was Hurricane Irma. Thank goodness I decided beforehand to grab a ton of books from the library because boy did I lose power! 

Right now, I'm about halfway through Learning JavaScript: Third Edition by Ethan Brown. Initially, I thought I might not learn a lot from it because of the title but a quick through it, I found that it is full of ES6 syntax and logical explanations of concepts that I grasped at a higher level but didn't know the "why" behind them. I've been thanking the coding gods for that wonderful foresight for about a week now!

Let's talk about a few things that LJ3 has explained further for me:

  1. For...of loop
    Syntax:
    for(variable of object)
        statement


    This for loop can be used over any iterable object or array and should be used when knowing the index isn't required. Typically, I've always needed to use the index for, at the bare minimum a React key so I've never used it before. I'm excited to use this for loop in algorithms.

  2. The difference in converting to Numbers using the Number constructor, parseInt , and parseFloat. 

    Okay, so this one definitely threw me for a loop! I've always used either parseInt or parseFloat. I didn't realize that you could also use Number for converting a number string into an integer! To be honest, it made me feel kind of silly for a second but, eh, what are you going to do?

    To clarify, the difference between parseInt and parseFloat is that parseInt only parses a number string involving numbers while parseFloat will still convert a number from a string that has other characters in it such as "365 days". It's really helpful when you prompt a user for a number of something and they give you the number as well as the measurement. 

  3. Symbol()

    I think this might be one of my new favorite things. It makes a variable explicit and unique. If you declare a symbol it matches no other symbol! You can also give them descriptions! This is super cool and I can't wait to read chapter 9 to dive deeper into this really nifty constructor and data type!

 

All in all, I love this book so far! It's staved off boredom and I've learned a bit about concepts I've already come in contact with in day-to-day coding. Moral of the story: Never judge a programming book by its title.