1 / 15

JavaScript

JavaScript. By: Daniel Moulton & Terrell Shelton. What are we looking at. JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight programming language JavaScript is usually embedded directly into HTML pages

waseem
Download Presentation

JavaScript

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JavaScript By: Daniel Moulton & Terrell Shelton

  2. What are we looking at • JavaScript was designed to add interactivity to HTML pages • JavaScript is a scripting language • A scripting language is a lightweight programming language • JavaScript is usually embedded directly into HTML pages • Separate .js files can be referenced from an HTML page • JavaScript is an interpreted language (means that scripts execute without preliminary compilation) • Everyone can use JavaScript without purchasing a license

  3. History • Originally developed in Netscape by Brendon Eich to compete with Microsoft. • Originally named Mocha LiveScript, it was later renamed JavaScript, confusing many into thinking it was associated with Java. • Microsoft adapts JavaScript in August 1996 • In November 1996, NetScape submits JavaScript to Ecma International for consideration of becoming industry standard.

  4. What does it do? • We use JavaScript to add interactivity to our HTML pages • Reacts to events • Basic Events • Advanced Events • Can read and write HTML elements • Can be used to validate data • Browser detection • Cookie creation

  5. Structure • Based off of the same structure as C. • Free flow • No need for semi colons to end lines.

  6. Binding • JavaScript uses both early and late binding • Early binding is more beneficial with larger programs. • Runtime performance is faster for early bindings.

  7. Data abstraction • There are several features that JavaScript has when it comes to data abstraction • Object based.

  8. Data types • It only has 3 primitive types • String • Numeric • Boolean • Types are associated with values, not variables. • ‘x’ can be defined as a number, then a string. • Duck typing • Object based.

  9. Defining data types • There are user defined data types • Anything defined as “class” is a user defined type

  10. Control • For loop • For-in loop • If statement • While loop • Do-while loop • switch • With • Try-catch-finally • Breaks

  11. Quirks • Security Flaws • Cross Site Scripting (XSS) • Client side code • Allows end users to see and change filesClientside code • Browser dependent

  12. Special Features • Vast libraries • Jquery • Relation to Java • Based off of C • Other than that, none

  13. For-in loops for( varmyVariable in document ) { document.write( myVariable + ' = ' + document[myVariable] + '<br>' ); }

  14. With x = Math.round( Math.LN2 + Math.E + Math.pow( y, 4 ) ); Can be replaced with: with( Math ) { x = round( LN2 + E + pow( y, 4 ) ); }

  15. Breaks for( var x = 1; x < 5; x++ ) { var y = 1; while( y < 7 ) { y++; if( y == 5 ) { break; } document.write(y); } }

More Related