JavaScript Details

JavaScript Snippets AJAX jQuery


Used symbols

⊗: left mouse button click, ⊗²: left mouse buttondouble click, ⊕: right mouse button click, ∇: input, ▼: select, >>: copy to


  1. Open text editor Sublime Text
  2. Write or paste some JS code
  3. ▼ File (Sublime Textmenu bar)▼ Save with encoding ▼ UTF-8 ∇ jScript_name.js ▼ Save
  4. In the HTML code call the saved   jScript_name.js with:
<script src="jScript_name.js"></script>
  • JavaScript: group statements together in code blocks, inside curly brackets {jScript code}.
  • JavaScript is case sensitive. Use camel case starting with a lowercase letter, e.g.: firstName, lastName.
  • JavaScript comments: between // and the end of a line, as well as between /* and */ .
  • Variable name must begin with a letter, dollar sign ($), or an underscore (_); do not allowed are:
    (a) number as the first character
    (b) dash (-) and period (.)
    (c) use keywords or reserved words

Object Model

jS Elements

Most used elements

date and time Lnk01 ; forms Lnk01 Lnk02

Elements by categories (links to the


  • Variable shortcuts:
  • (a) declaration and assignment in one statement:
  • var price = 200;
  • (b) many variables declaration and/or assignment in one statement:
  • var person = "John Doe", carName = "Volvo", price = 200;
  • Array: the values (separated by commas) are assigned inside a pair of square brackets:
  • var colors;
  • colors ['white', 'black', ' custom '];
  • Each item gets a number (starting with 0) called an index.
  • An expression results in a single value:
  • (a) assign value to a variable:
  • var color = 'yellow';
  • (b) use two or more variables and operators:
  • var area = 4 *3;
  • Operators: assignementarithemtic, string, comparison, logical.

  • function myFunction() {
    document.getElementById("demo1").innerHTML = "Hello Dolly!";
    document.getElementById("demo2").innerHTML = "How are you?";


Books contents

JavaScript and Jquery: Interactive Front-End Web Development /1/
Introduction /p.1/
Ch 1: The ABC of Programming /p.11/
Ch 2: Basic JavaScript Instructions /p.53/
Ch 3: Functions, Methods & Objects /p.85/
Ch 4: Decisions & Loops /p.145/
Ch 5: Document Object Model /p.183/
Ch 6: Events /p.243/
Ch 7: jQuery /p.293/
Ch 8: Ajax & JSON /p.367/
Ch 9: APIs /p.409/
Ch 10: Error Handling & Sorting /p.449/
Ch 11: Content Panels /p.487/
Ch 12: Filtering, Searching & Sorting /p.527/
Ch 13: Form Enhancement & Validation /p.567/

The Principles of Object-Oriented JavaScript /2/
Introduction /p.xvii/
Ch 1: Primitive and Reference Types /p.1/
Ch 2: Functions /p.17/
Ch 3: Understanding Objects /p.31/
Ch 4: Constructors and Prototypes /p.49/
Ch 5: Inheritance /p.65/
Ch 6: Object Patterns /p.79/

A Smarter Way to Learn JavaScript: The new approach that uses technology to cut your effort in half /3/
How I propose to cut your effort in half by using technology. /p.6/
How to use this book /p.9/
89 Chapters with examples (linked) /pp. 11 – 284/

JavaScript and jQuery: The Missing Manual, 3rd Ed.  /6/ Introduction /p.xiii/
Part One: Getting Started with JavaScript
Ch 1: Writing Your First JavaScript Program /p.3/
Ch 2: The Grammar of JavaScript /p.25
Ch 3: Adding Logic and Control to Your Programs /p.61/
Part Two: Getting Started with jQuery
Ch 4: Introducing jQuery /p.105/
Ch 5: Action/Reaction: Making Pages Come Alive with Events /p.147/
Ch 6: Animations and Effects /p.183/
Ch 7: Common jQuery Tasks /p.209/
Ch 8: Enhancing Web Forms /p.251/
Part Three: Getting Started with jQuery UI
Ch 9: Expanding Your Interface /p.299/
Ch 10: Forms Revisited /p.351/
Ch 11: Customizing the Look of jQuery UI /p.385/
Ch 12: jQuery UI Interactions and Effects /p.399/
Part Four: Advanced jQuery and JavaScript
Ch 13: Introducing Ajax /p.447/
Ch 14: Building a To-Do List Application /p.495/
Part Five: Tips, Tricks, and Troubleshooting
Ch 15: Getting the Most from jQuery /p.521/
Ch 16: Going Further with JavaScript /p.541/
Ch 17: Troubleshooting and Debugging. /p.587/
Part Six: Appendix
APPENDIX A: JavaScript Resources /p.619/

Secrets Of The JavaScript Ninja, 2nd Ed.  /10/Author’s introduction /p.xi/
1 JavaScript is everywhere /p.3/
2 Building the page at runtime /p.13/
3 First-class functions for the novice: definitions and arguments /p.33/
4 Functions for the journeyman: understanding function invocation /p.61/
5 Functions for the master: closures and scopes /p.91/
6 Functions for the future: generators and promises /p.126/
7 Object orientation with prototypes /p.167/
8 Controlling access to objects /p.199/
9 Dealing with collections /p.224/
10 Wrangling regular expressions /p.259/
11 Code modularization techniques /p.282/
12 Working the DOM /p.305/
13 Surviving events /p.332/
14 Developing cross-browser strategies /p.367/

HTML5: The Missing Manual, 2nd Ed.  /HTML, 2/APPENDIX B: JavaScript: The Brains of Your Page /p.451/

JavaScript Snippets AJAX jQuery