Download presentation
Presentation is loading. Please wait.
Published byPeter Daniel Modified over 8 years ago
1
JavaScript Luke Withrow Nathan Kempner
2
! Why JavaScript? Why not? Most popular language on the web Dynamic client-side Web applications Simple, powerful core functionality
3
A Brief History of JavaScript Born in 1995 Full of security flaws Lack of development environments, debuggers, and meaningful error messages. “JavaScript has suffered for years at the hands of those who would criticize it for being too unlike Java, or too much like Perl, or too often used by well-meaning but otherwise ignorant web designers, shoehorned into pages without thought of future compatibility, intelligent abstraction, or code reuse.” -Steve Champeon
4
A Slightly Less Brief History Accessibility for non-Java programmers Creator Brendan Eich Developed for the novice programmer Java vs. JavaScript Used to publish dynamic web content JavaScript became very popular very quickly Many programmers still considered it to be lacking Simple style and syntax further discredited it
5
Market The market for JavaScript is very specific. Javascript isn't used to write complex databases or operating systems. It is used to add simple enhancements to websites.
6
Object Oriented Scripting Object Oriented Event Driven Late Binding Interpreted by browser – Sometimes this causes problems
7
@ Data Types Numbers – Integers – Floats – Octals, Hexadecimals Strings Booleans Null & Undefined Objects (and Arrays) Loose data typing allows for flexibility and ease of use. Arrays aren’t a basic type; they’re pre- defined objects, like in Java or C++ $ #
8
Variables Naming conventions Global – Global variables are declared simply by assigning a value: x = 10; Local – Local variables are declared inside a function: var x; Undefined vs. Null-value X Y
9
{} Functions Variables, literals, and objects can be passed as arguments. The argument list is an array with the same name. Overloading is not implemented, but can be simulated. document.write(“Hello World!"); theDay = dateObject.getDate() ; JavaScript can be polymorphic.
10
Flow Control If…else While Do-while For Return Break Switch
11
Document Object Model
12
Netscape vs. IE “Many designers simply checked for Navigator in their scripts and ignored IE as a lost cause, just as early CGI programmers checked for "Mozilla" in the user agent environment variable, leading to the ridiculous convention, still followed today, whereby practically all of the major browsers announce themselves as "Mozilla" first, then "(compatible; BrowserName)" second. In short, JavaScript took on a not-entirely-deserved reputation for being yet another roadblock to a truly cross-platform standards-driven Web.”
13
ECMAScript: An Attempt at Standardization Lack of standards for JavaScript Discrepancies between IE and Netscape ECMAScript was an attempt at standardization It failed: Both browsers continued to develop their own DOMs and DHTML support
14
Fiefdoms of Functionality Problems with cross- browser support Different libraries were produced for each browser This only served to widen the gap New tools had to be developed to resolve these problems
15
Efficiency It's not compiled, it's interpreted. Because of this, it tends to be fairly slow. And because the tokens are generally fairly large, it is slower to interpret than some other scripting languages (like Perl).
16
Usability Dependent on DOM Source code difficult to hide Still lacks good debugger, IDE, and standardized development tools Still very popular, compared to the alternatives
17
Some Sample Code on (release) { setProperty ("Monster", _xscale, getProperty("Monster", _xscale)/1.1); setProperty ("Monster", _yscale, getProperty("Monster", _yscale)/1.1); worshipColor = new Color(Monster.sprite); worshipColorTransform = new Object(); worshipColorTransform.ra = worshipColor.getTransform().ra- 10; … worshipColorTransform.aa = 100; worshipColorTransform.ab = 100; worshipColor.setTransform(worshipColorTransform); if (getProperty("Monster", _yscale)<20) { gotoAndStop ("Scene1", "Squiggly"); }
18
Applications
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.