My Javascript Notes

A Few Tips

This webpage includes my notes regarding how to work effectively with javascript. It also includes information about notepad++, software, a link to more tutorial resources, personal quotes about coding, how to run a simple script and even program your first game.

Javascipt is another language!?

"Well, imagine apple. It has properties taste and color. And it has method - eat, when we eat it we can
feel the taste, and method sees - when we see it we can feel the color." ~ Berezin

What is it?

A client-side scripting language.

What's it all all about?

Changing properties in some sequence.

Uses

1. Animation on webpage which is now largely being replaced by CSS
2. User input validation
3. Interaction with a server

Some slack

There is a standard library for routine functions. Borrowing from codes is quite common as a result but if the project is serious and there is time to develop it then start from scratch.

How css, html and js factor in

Css can be used to modify the look and html to pin the element's position. It is good practice to separate js, html and css. It ensures code accuracy.

The body

The scripts in the html between the body should be somewhere between 1-5
lines. This is not strict but it's better to follow.

Variables

Variables have scope from where they can be accessed, assigned and or operated. You can declare a variable anywhere (globally, out of {} blocks). For the sake of simplicity we, will assume that the variable is being visible only in its own {} block. If it has no such block - it is global and is visible from anywhere.

Running it

The browser executes the system from top to bottom. window.onload - browser is ready to draw our webpage, the main event, since everything is ready. Always search for event window.onload, addEventListener, in html

Testing it

It's pretty routine to test websites on local servers before putting a page up on the internet. You would download xampp package. This will create apache webserver on your local machine but for a simple js, html, css- cool notepad, NetBeans IDE, or Eclipse IDE will do the trick.

Philosophy

Practice is the best teacher.

Personal Insight

There's absolutely nothing wrong with re-inventing the wheel, especially when you are offering your take on that which has already been incorporated into the framework.

Incentive to Learn

This makes a great hobby and allows you to decorate your webpage with a favorite game or two.

Any Game Consists of:

1. Process user input
2. Draw the scene
3. Perform game logic

2D vs 3D

-2d games can be pretty easily built from scratch.
-3d is where things start to move to frameworks; with something like strategy, pathfinding and or AI.
-3d code is more involved with linear algebra.