Thursday, March 5, 2015

Day 80: More Javascript Loops and Arrays

I'm still working on the arrays quiz.  The quiz has a second part to it, which I plan on working on today.  So, as I was going over the code for the quiz, I thought of a way to solve Euler problem one, I worked on that for some time, and I solved it!  Here's my solution to Euler problem one:

var i = 0;
var total = 0;
for (i = 0; i < 1000; i += 1) {
if(i % 3 === 0 || i % 5 === 0) {
total = total + i;
console.log(total);
}
}
document.write(total)

Stoked!!!  I worked on Euler problem 2 as well today, and I made up some code to create a Fibonacci Sequence!  This is it:

    var fibArray = [1,2];
    for (var i = 0; i < 8; i += 1) {
    var fib1 = fibArray[fibArray.length - 2]
var fib2 = fibArray[fibArray.length - 1]
    var fib = fibArray[fibArray.length - 1] + fibArray[fibArray.length - 2];
    fibArray.push(fib);    
    }
    document.write(fibArray)

The length of the sequence is determined by the i < 8 section of the code, so you can make it go as long as you like.  I had a lot of fun creating that, and I'm really proud of it because I came up with it myself!  Today was extremely productive, while I didn't earn any Treehouse points, I did go over the code for the quiz, solved Euler problem one, and began work on Euler problem 2.  I ordered a book filled with Javascript problems and I can't wait for it to come in!  I want to get to work on the problems as soon as possible, as working on problems is a great way to solidify the concepts involved.

SUMMARY OF CODING SKILLS

Total Treehouse Points: 5,385

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

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

Treehouse Badge(s) Earned Today:



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)
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
In Progress: "Eloquent JavaScript," by Marijn Haverbeke (On pg 27)
In Progress: "Head First Javascript," by Eric Freeman and Elisabeth Robson (On pg 56)

My Progress on The Odin Project:
1.  Introduction to Web Development             100% Complete
2.  Web Development 101                                29% Complete
3.  Ruby Programming                                       0% Complete
4.  Ruby on Rails                                               0% Complete
5.  HTML5 and CSS3                                           0% Complete
6.  Javascript and JQuery                                  0% Complete
7.  Getting Hired as a Web Developer                 0% Complete

Hours Spent Coding Today: 5.5
Total Hours Coding: 385

No comments:

Post a Comment