JavaScript Practice | Day 10

Posted in Practice, Programming Tagged: , ,
Tyson Hood - Web Dev - JavaScript Paractice - CodeCademy API course

The JS endeavor for the day is getting out of hand, so I’m throwing in this parsing practice as a good entry for the day, so I can move on an come back tomorrow. What am I trying to figure out? API calls and data retrieval…

When I was doing my nanodegree with Udacity, we did a couple of API calls for the apps we were building. Since it’s been about a year and this is a new language (I used Java then), I’ve forgotten the majority of how to do this, so I thought it would be a good time to get it back into my memory. Plus, it would make for some good longer, and more interesting projects for this coding challenge.

After going through the CodeCademy API rundown, perusing a dozen or two articles, and spending almost 3 hours on the topic, I decided it’s time to move onto finishing my website. We’ll return tomorrow to try back at it, but for now… Here’s a little JSON parsing project. This will be good for when I do figure out API’s because I’ll have to parse the response for the data I wish to find/use.

JSON Parse

Very simple JSON parse example

The problem is a very simple one, as I’ve run out of time. Essentially, I’m creating a variable and defining it with an object. Inside this object are a couple key-value pairs. On the next line, I’m simple using the built in function of JSON.parse() to parse the object. Then, I console logged the parts of the object for which I’m searching. In this case, obj.count searches for the value of “count” in the object, which returns to me, 42.

To come…

Hopefully, by the end of the week, I’ll know full API requests and parsing. A lot of the tutorials I find use jQuery, which may be a sign I also need to get better at jQuery (or just get better at JavaScript (or both)). Either way, there is a lot to do this week. What I’d like to be able to do with this weather API example which everyone uses, is to make a weather tracker. Then I can always be where it rains… or has lightning!

Thank you much.

Written by Tyson Hood

Leave a Reply

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

Like what you see and want more info?

Click below to get on the mailing list.

Yes, send me some info!