Saturday, January 2, 2016

Day 165: "JavaScript & JQuery" by Jon Duckett

Today's the first day of the new year.  I'm starting on page 96 of the Duckett book.  I have to finish as much as possible today, so as to finish the book by my goal date of January 5th.

I learned a new way to create a function, via a function expressions, like so:

var area = function(width, height) {
return width * height;
};

You could then call it like so:

var size = area(3, 4);

When you use a function expression, it can only be called AFTER the interpreter gets to the declaration statement, whereas with a regular function you can call it before you have defined it, as long as it is defined somewhere in the code.

I'm on page 104 now.  Gotta keep it up.  We can create an empty object in two ways, here's two examples:

var hotel = new Object();

or

var hotel = {};

Either works.  To add properties and methods, we would do this to add a property:

hotel.name = "Miramar";

or this to add a method:

hotel.checkAvailability = function() {
  return this.rooms - this.booked;
};

To delete a property, we can do:

delete hotel.name;

If you just want to clear the value of a property, simply set it to a blank string, like so:

hotel.name = "";

This is a constructor function (note that its name is capitalized):

function Hotel(name, rooms, booked) { 
  this.name = name;
  this.rooms = rooms;
  this.booked = booked;
  this.checkAvailability = function() {
    return this.rooms - this.booked;
  };
}

So then at any time, I can simply call the function, enter parameters, and it creates a new Hotel object.  When we create an object using that function, we should use the new keyword, like so:

var miramar = new Hotel("Miramar", 400, 287);

I'm on  page 130.

I learned about immediately invoked function expressions, which allows you to prevent other variables from intruding on your function, the abbreviation for these is IIFE. 

We started working with milliseconds (a thousandth of a second), and it comes in handy when using the date object.  There's 31556900000 milliseconds in a non-leap year.  If you want to add 7 days time in milliseconds, you would do this:

today.getTime() + 7 * 24 * 60 * 60 * 1000

Neat.

The Logical Not logical operator reverses a boolean value, like so:

!(2 < 1)

Would evaluate to true, instead of false, due to the Logical Not operator.

When a variable has been declared, but not yet assigned a value, it would be undefined.  If you try to do this:

('ten'/2) 

The result would be NaN, which is a number data type value that stands for Not A Number.

Ok, I closed out the day on page 198.

SUMMARY OF CODING SKILLS

Total Treehouse Points: 5,503

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

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 
Completed: "HTML and CSS," by Jon Duckett
In Progress: "JavaScript and JQuery," by Jon Duckett (on pg 198 of 622)

My Progress on The Odin Project:
1.  Introduction to Web Development                                             100% Complete
2.  Web Development 101                                                               33% Complete 
Note: I 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: 5
Total Hours Coding: 757

No comments:

Post a Comment