HTML/CSS
Ah... Good 'ol coding! There's nothing quite like it! Well, the colors are coming out! the hexadecimal colors to be exact. I knew that this was gong to happen, I just thought it was going to a long time ago. But now that these colors have come out, I'll be coloring all the things!
One of the things I was doing with Caret earlier was HTML. I had HTML and CSS running together. I save it to the computer and then open it and and it open up into the browser. You get a live preview of what you're working on. And that is so cool! I just have to figure out how to get .js into the mix. I assume that's coming down the road really fast. Also, I need to get Crouton going correctly so I can do some Linux stuff. Like Github. Anyhoo... back to the HTML/CSS. I am now on a review of the CSS that I've already done. It's pretty easy to remember the names of things in CSS because a lot of the names are the same.
Now, if y'all remember, I said there would be more .js today, and there is! So, once I finish the review we'll head over there. Aaaaand yup. Nothing to write home about!
JavaScript
We're still on <this>, folks. And I don't mind. This thing has a lot of different uses. I love it! Over the weekend, I did not get a chance to do any classwork(family birthdays, social protocols, yada yada yada) and this was the first weekend where I actually was excited to get back to my studies! I'm having so much fun doing this! Ok. The lesson that I'm working on had this:
var square = new Object();
square.sideLength = 6;
square.calcPerimeter = function() {
return this.sideLength * 4; };
// help us define an area method here
var p = square.calcPerimeter();
var a = square.calcArea();
The instructions said to create a <calcArea> function that gave the area, and to use the square.calcPerimeter as a guide. All I had to do was:
var calcArea = new Object();
square.calcArea = function(){
return this.sideLength * this.sideLength;
};
Which, in hindsight was easy, but what to return was an issue, because I had the wrong idea about area. I got it in the end. They've got me working on constructors now. They're like an Object, but more global. Here's an example:
function Person(name,age, gender) {
this.name = name;
this.age = age;
this.species = "Homo Sapiens";
this.gender=gender;
}
var sally = new Person("Sally Bowles",39, "f'male");
var holden = new Person("Holden Caulfield",16,"f'male");
console.log("sally's species is " + sally.species + " and their age is " + sally.age + "and their gender is " + sally.gender);
console.log("holden's species is " + holden.species + " and their age is " + holden.age + " and their gender is " + holden.gender);
No comments:
Post a Comment