Show Menu

COSC-3353-Ch3at Sheet Cheat Sheet by

One page cheat sheet for COSC-3353 midterm 2


// Define a new class
function Person() {}

// Create a new instance
var person1 = new Person();

// Inheritance
Person.prototype.walk = function() {

Simple Alert

          <script type="text/javascript">
               alert('Hello JavaScript!');

Simple JavaScript

          <script type="text/javascript">
               alert('Hello JavaScript!');
               document.write('JavaScript rulez!');

Steps of Ajax Operation

1. A client event occurs.
2. An XMLHtt­pRe­quest object is created.
3. The XMLHtt­pRe­quest object is config­ured.
4. The XMLHtt­pRe­quest object makes an asynch­ronous request to the web server.
5. The web server returns the result containing XML document.
6. The XMLHtt­pRe­quest object calls the callback() function and processes the result.
7. The HTML DOM is updated.

Accessing Elements

// By Id
// By class name
// By tag name


Inline - by using the style attribute inside HTML elements
Internal - by using a <st­yle> element in the <he­ad> section
External - by using a <li­nk> element to link to an external CSS file


* Supports breakp­oints, watches, JavaSc­ript, CSS, HTML
* Useful for CSS and HTML
* Edit documents in realtime
* Shows how CSS rules apply to elements
* Shows Ajax requests and responses
* Firebug is written mostly in JavaScript


This is called encaps­ula­tion, by which every class inherits the methods of its parent and only needs to define things it wishes to change
Abstra­ction is a mechanism that permits modeling the current part of the working problem. This can be achieved by inheri­tance (speci­ali­zat­ion), or compos­ition. JavaScript achieves specia­liz­ation by inheri­tance, and compos­ition by letting instances of classes be the values of attributes of other objects.
Just like all methods and properties are defined inside the prototype property, different classes can define methods with the same name; methods are scoped to the class in which they’re defined. This is only true when the two classes do not hold a parent­-child relation


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          AngularJS Cheat Sheet
          JavaScript Cheat Sheet
          Web Programming Cheat Sheet

          More Cheat Sheets by foobar

          Docker basics Cheat Sheet