JavaScript at its core looks a lot like C++ or Java, but is generally simpler.




Using JavaScript

Special tags and event handlers distinguish JavaScript from the document layout language.






Since you can't control a user's settings, if they have turned JavaScript off you may wish to do some things differently or warn the user of limited functionality.

By putting document language between <noscript>....</noscript> tag pairs, a knowledgeable browser will only display them when JavaScript is turned off:

<script language="JavaScript">
  document.write("Please turn off JavaScript to
                  demonstrate this feature.")
</script>
<noscript>
  Please turn on JavaScript <i>for the rest of this presentation</i>.
</noscript>
 
document.write("This statement is designed to generate an error"

Comments

JavaScript provides for comments, but using them has its disadvantages.



Data Types

JavaScript has a small but full-featured set of data types.


Hexadecimal integer literals can have their X and A-F characters in either upper or lower case.


Variables and Assignments

JavaScript variables are very flexible, and can represent all of the above data types.