I started the day on Chapter 27 Generating Random Numbers. Here's the code we used to generate a random number from 1 through 6:
var bigDecimal = Math.random();
var improvedNum = (bigDecimal * 6) + 1;
var numberOfStars = Math.floor(improvedNum);
The first line generates a 16 place decimal and assigns it to the variable.
The second line converts the 16 place decimal to a number ranging from 0.00 to 5.99, then adds 1, so the range ends up as 1.00 through 6.99 (there's many more zeros that I am not typing, 16 zeros/decimal places, to be exact). The third line rounds the value represented by the new variable down to the nearest integer that ranges from 1 through 6.
Let me practice that again:
var x = Math.random();
var y = (x * 6) + 1;
var z = Math.floor(y);
O.k., moving on to Chapter 28 Converting Strings to Integers and Decimals. We used parseInt() and parseFloat(), which convert strings to numbers. Int will chop off (it does NOT round, it chops off) any decimals, leaving only whole integers, and Float will get the exact decimals.
I finished chapter 29 Converting Strings to Numbers and Numbers to Strings, and I'm on Chapter 30 Controlling the Length of Decimals now. I've noticed that these are methods (you put the item to be modified before the method):
.toString()
And these are functions (you put the item to be modified within the parentheses):
Number()
Just a note.
I finished Chapter 30, and now I'm on Chapter 31 Getting the Current Date and Time. I'm stopping here so I can do all the time chapters tomorrow, and then move on to functions! Yeah!
SUMMARY OF CODING SKILLS
var bigDecimal = Math.random();
var improvedNum = (bigDecimal * 6) + 1;
var numberOfStars = Math.floor(improvedNum);
The first line generates a 16 place decimal and assigns it to the variable.
The second line converts the 16 place decimal to a number ranging from 0.00 to 5.99, then adds 1, so the range ends up as 1.00 through 6.99 (there's many more zeros that I am not typing, 16 zeros/decimal places, to be exact). The third line rounds the value represented by the new variable down to the nearest integer that ranges from 1 through 6.
Let me practice that again:
var x = Math.random();
var y = (x * 6) + 1;
var z = Math.floor(y);
O.k., moving on to Chapter 28 Converting Strings to Integers and Decimals. We used parseInt() and parseFloat(), which convert strings to numbers. Int will chop off (it does NOT round, it chops off) any decimals, leaving only whole integers, and Float will get the exact decimals.
I finished chapter 29 Converting Strings to Numbers and Numbers to Strings, and I'm on Chapter 30 Controlling the Length of Decimals now. I've noticed that these are methods (you put the item to be modified before the method):
.toString()
And these are functions (you put the item to be modified within the parentheses):
Number()
Just a note.
I finished Chapter 30, and now I'm on Chapter 31 Getting the Current Date and Time. I'm stopping here so I can do all the time chapters tomorrow, and then move on to functions! Yeah!
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)
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)
In Progress: "A Smarter Way to Learn Javascript," by Mark Myers (on pg 89)
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: 2
Total Hours Coding: 557
No comments:
Post a Comment