Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Language Fundamentals - Introduction to Java Script - Lecture Slides, Slides of Javascript programming

Here is my collection on JavaScript lectures. It includes tutorials as well as general concepts explanations. Particularly these slides contain: Language Fundamentals , Browser, Primitive Data Types, Boolean, Operators, Statements, Javascript is Not Java, Warnings

Typology: Slides

2013/2014

Uploaded on 01/29/2014

surii
surii 🇮🇳

3.5

(13)

130 documents

1 / 18

Toggle sidebar

Related documents


Partial preview of the text

Download Language Fundamentals - Introduction to Java Script - Lecture Slides and more Slides Javascript programming in PDF only on Docsity!

JavaScript

Language Fundamentals I

About JavaScript

  • JavaScript is not Java, or even related to Java
    • The original name for JavaScript was “LiveScript”
    • The name was changed when Java became popular
    • Now that Microsoft no longer likes Java, its name for their JavaScript dialect is “Active Script”
  • Statements in JavaScript resemble statements in Java,

because both languages borrowed heavily from the C

language

  • JavaScript should be fairly easy for Java programmers to learn
  • However, JavaScript is a complete, full-featured, complex language
  • JavaScript is seldom used to write complete “programs”
  • Instead, small bits of JavaScript are used to add functionality to HTML pages
  • JavaScript is often used in conjunction with HTML “forms”
  • JavaScript is reasonably platform-independent

Using JavaScript in a browser

  • JavaScript code is included within - Notes: - The type attribute is to allow you to use other scripting languages (but JavaScript is the default) - This simple code does the same thing as just putting

    Hello World!

    in the same place in the HTML document - The semicolon at the end of the JavaScript statement is optional - You need semicolons if you put two or more statements on the same line - It’s probably a good idea to keep using semicolons

    JavaScript isn’t always available

    • Some old browsers do not recognize script tags
      • These browsers will ignore the script tags but will display the included JavaScript
      • To get old browsers to ignore the whole thing, use:
      • The <!-- introduces an HTML comment
      • To get JavaScript to ignore the HTML close comment, -->, the // starts a JavaScript comment, which extends to the end of the line
    • Some users turn off JavaScript
      • Use the to display a message in place of whatever the JavaScript would put there

    Where to put JavaScript

    • JavaScript can be put in the or in the of an

    HTML document

    • JavaScript functions should be defined in the
      • This ensures that the function is loaded before it is needed
    • JavaScript in the will be executed as the page loads
    • JavaScript functions can be put in a separate .js file
    • - - Put this in the - An external .js file lets you use the same JavaScript on multiple HTML pages - The external .js file cannot itself contain a