Wednesday 19 January 2011

Pre-Entrance Task 1: Javascript Basics Video 1 - Learning Journal

I have learned the brief history of Javascript and how despite its name suggesting otherwise, it is not related to Java and it is a real programming language. I also learned that there were certain inherent mistakes that had carried over since its conception. These mistakes in its design, can cause potential programming problems that the coder has to be aware of.  I learned of a few today.

One such nuisance was the addition operator. It acts as both addition for numbers and concatenation of strings similar to other languages. But if one of the operand is not a number, it will convert both into strings and concatenate them.

The second was that it only has one number type and it is the 64bit floating point, which may cause a problem dealing with money because floating points can only give you an approximation of the figure. To counter that one should always convert any currency into its smallest unit and do the mathematical calculations as integers and then convert the number back into decimals.

The third mistake is Javascript’s large list of reserved words, even though only a small proportion of the words on the list are used in the language. You are also not allowed to use any reserved words in  creating names using the dot notation.

The forth point to be aware of  is the use of == and != operators. The equal and not equal operators can do type coercion. So it was recommended that you use === and !== if you want exact equality and inequality.

I have also learned a strange value called NaN which, stands for Not a Number.  If anywhere in your programming produces a result of NaN, you final value will also be NaN (toxic). It does not equal to anything, not even NaN, but it is a Number.


The key ideas of the Javascript language listed were:
Load and go delivery
Loose typing
Objects as general containers
Prototypal Inheritance
Lambda
Linkage Through global variables.

I am looking forward to learning more about Javascript when the course starts.

No comments:

Post a Comment