Monday, 11 August 2008

Head First JavaScript By Michael Morrison

Just now i completed reading Head First JavaScript By Michael Morrison

Nice book written by Michael Morrison.Well i enjoy reading books from Head First Camp always!!!!!!!!! though not much knowledge can be gained for people already familiar with the subject.

Below are the points i wanted to share with readers from this book.

1) Javascript brings a web page to life by allowing it to respond to a user's input.

2) Javascript is an interpreted language.

3) Data types directly affect how you work with data in JavaScript code.For example, alert boxes only display text, not numbers. So numbers are converted to text behind the scenes before they’re displayed.

4) Identifier Rules

a) An identifier must be at least one character in length.

b) The first character in an identifier must be a letter, an underscore (_), or a dollar sign ($).

c) Each character after the first character can be a letter,an underscore (_), a dollar sign ($), or a number.

d) Spaces and special characters other than _ and $ are not allowed in any part of an identifier.

5) parseInt() and parseFloat() converts text to a number.When we try to parse a non-number string we get a NaN.

Example:

parseFloat("$31.50") = NaN


6) What happens if you use parseInt() to convert a string containing a decimal number?
Answer: All that happens is that JavaScript assumes you don’t care about the fractional part of the
number, so it returns only the integer portion of the number.

7) Client window is only part of a browser window that displays a web page.

document.body.clientHeight and document.body.clientWidth can be used.

8) JavaScript destroys all variables when browser closes or the page reloads.

9) Functions eliminate duplicate code.

10) Seperating functionality from content makes web applications to build and maintain.

11) Regular Expressions always start and end with a forward slash.

12) Use Prototype to work at a class level.
Classes in javascript are made possible in javascript thanks to a hidden object called prototype that exists in every object as a property.The prototype object allows you to set properties and methods that are owned at the class level,as opposed to within an instance.In the case of methods,the prototype object is how you establish that a class owns a method.

Example in Blog class we can declare a method as follows


Blog.prototype.toHTML=function() {

}

var blogEntry1=new Blog("Not much going on.....");
blogEntry1.toHTML();



Below are table of contents

1 the interactive web: Reacting to the Virtual World

2 storing data: Everything Has Its Place

3 exploring the client: Browser Spelunking

4 decision making: If There’s a Fork in the Road, Take It

5 looping: At the Risk of Repeating Myself

6 functions: Reduce, Reuse, Recycle

7 forms and validation: Getting the User to Tell All

8 wrangling the page: Slicing and Dicing HTML with the DOM

9 bringing data to life: Objects as Frankendata

10 creating custom objects: Having It Your Way with Custom Objects

11 kill bugs dead: Good Scripts Gone Wrong

12 dynamic data: Touchy-Feely Web Applications


Hope you enjoy reading this book

About the Author

Michael Morrison is a writer, developer, toy inventor, and author of a variety of books covering topics such as Java, Web scripting, game development, and mobile devices. Some of Micheal's notable writing projects include JavaScript Bible, 6th Edition (Wiley, 2006),Teach Yourself HTML and CSS in 24 Hours, 7th Edition (Sams Publishing, 2005), Beginning Mobile Phone Game Programming (Sams Publishing, 2004) and Java Unleashed (Sams Publishing, 1997). Michael is the intructor of several Web-based courses, including DigitalThink's Introduction to Java 2 series, JavaBeans for Programmers series, and Win32 Programming series (www.digitalthink.com).

In addition to his primary profession as a writer and technical consultant, Michael is the founder of Stalefish Labs (www.stalefishlabs.com), an entertainment company specializing in games, toys, and interactive media. When not glued to his computer, skateboarding, playing hockey, or watching movies with his wife, Masheed, Michael enjoys hanging out by his koi pond.

No comments: