JavaScript: An Analysis Michael Owen
Brief History Founded at NetScape by Brendan Eich Mocha, LiveScript, then JavaScript No apparent relation to Java Embedded in HTML Interpreted language Microsoft’s version is Jscript Standardized in Nov. 1996
Data Types Only three primitive types –String –Number –Boolean All numbers are stored as floating point numbers Variables are not explicitly declared
Object-Oriented Support Prototype-oriented programming Everything but primitive types are considered objects Objects seem hidden within the code Arrays are dynamic which can be dangerous Fully supports inheritance, encapsulation, and polymorphism
Subprograms Functions are treated as objects but act the same way you’d expect Parameters are more like guidelines Can call functions recursively Can declare functions within functions
Readability of JavaScript Easy to read if familiar with Java or C++ Suffers a bit since variables are never declared with a type Orthogonality is high with only three primitive data types Can perform any operation between any two data types
Writability of JavaScript Only a few data types to learn Don’t need to worry about declarations No type checking Objects are a little convoluted Easy to write, but at what cost?
Reliability of JavaScript Suffers due to lack of type checking Really depends on what purpose the code is for Better used for less important tasks
Cost of JavaScript Very small if the team is already familiar with Java or C++ Does not need to compile Does not require a lot of system resources
Bottom Line Overall, a very good language Does a lot of things right Does one thing very wrong