Start with letter or an underscore character and dollar sign Can contain

Start with letter or an underscore character and

This preview shows page 3 - 5 out of 5 pages.

Start with letter or an underscore character and dollar signCan contain letters, numbers, underscore and dollar sign.Variable names are case-sensitiveUse either underscore or Camel Casing to name a variable with more then one wordlet first_name or let firstNameUse meaningful names (gagleegoo !!!!! Is not meaningful)Primitive data typesThere are 6 primitive data types in JavaScriptBoolean— true or falseNull— no valueUndefined— a declared variable but hasn’t been given a valueNumber— integers, floats, etcString— an array of characters i.e wordsSymbol— a unique value that's not equal to any other valueObjectJavaScript CommentsSingle line comment //Multiple line comments /* … */Window and Document Objectswindow.alert(123) or alert(123)let num = prompt(‘enter a number’, 10)print() <a href=‘#’ onclick=‘print()’>Print this page</a>window.location ( window.open(‘’);Document objectdocument.write(value) or document.writeln(value)Syntax error and logical errors- is when something is misspelled logical error – when there something that doesn’t make sense
Background image
Chapter 2 How to code JavaScript-Using a text editor like Notepad++ or TextWrangler, enter and edit XHTML, CSS, and JavaScript filesHow to load JavaScript from an external file<script type="text/javascript" src="sales_tax.js"></script>Scr = the file name
Background image
Image of page 5

You've reached the end of your free preview.

Want to read all 5 pages?

  • Fall '18

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture