JavaScript for beginners / PDF
JavaScript for beginners / PDF
Sample of the pdf document
Introduction to JavaScript
• NOT Java
– JavaScript was developed by Netscape
– Java was developed by Sun
• Designed to ‘plug a gap’ in the techniques available for creating web-pages
– Client-side dynamic content
• Interpreted
JavaScript vs. Java
• JavaScript is becoming what Java was originally intended to be
– Java Applets are meant to be lightweight downloadable programs run within the browser for cross platform compatibility
– Java = Bloated
– JavaScript is actually lightweight and accomplish most of what Applets do with a fraction of the resources
What is it used for today?
• Handling User Interaction
– Doing small calculations
– Checking for accuracy and appropriateness of data entry from forms
– Doing small calculations/manipulations of forms input data
– Search a small databased embedded in the downloaded page
– Save data as cookie so it is there upon visiting the page
• Generating Dynamic HTML documents
• Examples
– Bookmarklets
– Google Maps
– Google Suggest
JavaScript Syntax - Variables and Literals
• Declaration
– Explicit: var i = 12; // no ‘var’ in declaration
– Implicit: i = 12;
• Variable Scope
– Global
• Declared outside functions
• Any variable implicitly defined
– Local
• Explicit declarations inside functions
JavaScript for beginners / PDF
0 commentaires: