Wednesday, November 11, 2015

Day 155: Treehouse Objects Course

Today I'm continuing with the Treehouse course on Objects.  I need to understand Objects well in order to solve the next FCC problem.  Afterwards, I have a choice of delving more into Treehouse or working on the Duckett books.  I'm leaning towards the Duckett books, because of how much I learned from the Myers book, but it's all open.  The main thing is to keep learning and continuously apply that knowledge by creating various projects, projects which will serve as my portfolio.

By the time I'm applying for a job, I want to be HIGHLY qualified.  I have the time to invest in myself, and there's no reason to not take advantage of that.  This is great!

O.k., say we have this object:

var brazil = {
  hemisphere: 'southern',
  holidays: ['carnival', 'turkey day', 'beach day'],
  age: 143 
}

Then, this below: 

brazil.holidays.length

Would let us know how many holidays brazil has, and this below:

brazil.age += 1

Would add 1 to the age of brazil.  

Then this below would access the property 'turkey day'.

brazil.holidays[1];

Would access the property 'turkey day'.  A JavaScript object literal is like a series of named variables, each with their own value, packaged into a single item (the object).  When making objects, be sure to denote strings with quotes, and anything not in quotes should be a variable, or a number, or a boolean, for example.

When using a for in loop, only bracket notation will work, do not use dot notation with a for in loop.  Here's out object literal again:

var brazil = {
  hemisphere: 'southern',
  holidays: ['carnival', 'turkey day', 'beach day'],
  age: 143 
}

And here's a for in loop that iterates through it, outputting the property values:

for (var prop in brazil) {
  console.log(brazil[prop])
}

The output would be: 

southern
["carnival", "turkey day", "beach day"]

143

Neat.  On the other hand, if you just want to access the properties, this would do it:

for (prop in brazil) {
  console.log(prop);
}

The output would be:

hemisphere
holidays
age

If you want to output every property and property value, this would do it:

for (prop in brazil) {
  console.log(prop, ' : ', brazil[prop]);
}

The output would be:

hemisphere  :  southern
holidays  :  ["carnival", "turkey day", "beach day"]

age  :  143

This does the same thing:

var shanghai = {
  population: 14.35e6,
  longitude: '31.2000 N',
  latitude: '121.5000 E',
  country: 'CHN'
};

for (var key in shanghai) {
  console.log(key, ': ', shanghai[key]);

}

Think of key like the i in for loops.

O.k., I spent a few days down in South Texas with my family, and now it's the 11th of November, time for the first Free Code Camp Austin Meetup!  I'm heading out in a bit to have the first study session for my meetup group, which I'll be hosting!  :)

Great stuff!

My class on JavaScript objects today mentioned JSON for the first time, which stands for JavaScript Object Notation.  JSON is commonly used with a technology called AJAX to exchange information with a web server.  Information sent in JSON format can easily be converted to a JavaScript format, and be displayed on a webpage.  I downloaded a Chrome extension called JSON view, which makes viewing JSON data easier.  JSON is a string formatted to look like a JavaScript object, which allows it to be easily converted to a JavaScript object.

The meetup was great, I just got home and posted a recap of the meeting on the FCC group Facebook page.  Time to get some sleep!

SUMMARY OF CODING SKILLS

Total Treehouse Points: 5,449

Treehouse Points by Subject Matter (Miscellaneous not included): 
HTML:                                663 
CSS:                                1,599 
Design:                            1,193 
Development Tools:            747 
JavaScript:                      1,184

Treehouse Ranking (%): "You have more total points than 93% of all students."

Treehouse Courses Completed:
How to Make a Website
HTML
CSS Foundations
CSS Layout Techniques
Aesthetic Foundations
Design Foundations
Adobe Photoshop Foundations
Adobe Illustrator Foundations (66% complete, switched focus from web design to web dev)
Console Foundations
Git Basics
Introduction to Programming
JavaScript Basics

Codecademy (& other) Courses Completed:
HTML and CSS (Codecademy) 

Books Read or in Progress:

Completed: "Head First HTML and CSS," by E. Robson & E. Freeman
Completed: "A Smarter Way to Learn JavaScript," by Mark Myers 

My Progress on The Odin Project:
1.  Introduction to Web Development                                             100% Complete
2.  Web Development 101                                                               33% Complete 
Note: Switched to FCC for the great online community and better updates/support.

My Progress on Free Code Camp (FCC): 
1. Get Started with Free Code Camp                                                      Complete
2. HTML5 and CSS                                                                                  Complete
3. Responsive Design with Bootstrap                                                       Complete
4. Gear up for Success                                                                           Complete
5. jQuery                                                                                              Complete
6. Basic JavaScript                                                                                 Complete
7. Object Oriented and Functional Programming                                     Complete
8. Basic Algorithm Scripting                                                                   Complete
9. Basic Front End Development Projects                                                 On 4 of 5
10. Intermediate Algorithm Scripting                 On 4 of 21 (#13 and #14 also done)

11. JSON API's and Ajax
12. 
Intermediate Front End Development Projects
13. Claim Your Front End Development Certificate
14. Upper Intermediate Algorithm Scripting
15. Automated Testing and Debugging
16. Advanced Algorithm Scripting
17. AngularJS
18. Git
19. Node.js and Express.js
20. MongoDB
21. Full Stack JavaScript Projects

22. Claim Your Full Stack Development Certificate

After the 800 hours of FCC work above, there are 800 more hours of non-profit coding projects.


Hours Spent Coding Today: 4
Total Hours Coding: 720

No comments:

Post a Comment