Wednesday, February 01, 2006

JavaScript Data Information

“A weakly typed language treats variables as generic containers which can hold any potential type of information. JavaScript is weakly typed because it treats functional objects as generic entities that can also hold multiple potential structures.” A dynamic language is one where the compiler does not need to know data types at compile time. The type can be modified whenever. JavaScript implements dynamic typing through the use of prototypes, which allows the possibility to alter both instance and class structures at runtime. Inheritance is accomplished by cloning existing objects which serve as prototypes for the new ones. In addition, JavaScript interpreters understand two different, basic types of data: numbers and character strings. Numbers in JavaScript are represented in binary as IEEE-754 Doubles. JavaScript also uses arrays as maps from integers to values. “Arrays have a length property that is guaranteed to always be larger than the largest integer index used in the array. It is automatically updated if one creates a property with an even larger index.” It also gets rid of the largest index if a smaller number is written to the array. Opposed to C that relies on standard I/O libraries, a JavaScript engine relies on a host environment in which it is embedded. For example, JavaScript embedded in a web browser connects through interfaces called Document Object Model (DOM) to applications. A major use of JavaScript is to write functions that are embedded in HTML pages that interact with the DOM of the page to perform actions that could not be possible through HTML alone. JavaScript is also embedded in other applications outside of the web like Adobe Acrobat, Mozilla, Microsoft’s Active Scripting etc… JavaScript gets access to the host environment in each one of these applications because they all provide their own object model that grants access.

0 Comments:

Post a Comment

<< Home