User:Jarle Pahr/Javascript

From OpenWetWare

Jump to: navigation, search

http://en.wikipedia.org/wiki/JavaScript

JavaScript Guide: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide

https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript

https://developer.mozilla.org/en-US/docs/Web/JavaScript

https://itunes.apple.com/us/itunes-u/programming-abstractions/id384232917


http://www.w3schools.com/js/js_functions.asp

http://www.w3schools.com/js/js_loop_for.asp

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript?redirectlocale=en-US&redirectslug=JavaScript%2FIntroduction_to_Object-Oriented_JavaScript


https://developer.mozilla.org/en-US/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript?redirectlocale=en-US&redirectslug=JavaScript%2FIntroduction_to_Object-Oriented_JavaScript

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain

Javascript projects: http://www.learnstreet.com/cg/simple/projects/javascript

Tutorials/courses

http://www.codecademy.com/courses/javascript-beginner-en-x9DnD/0/1?curriculum_id=506324b3a7dffd00020bf661

http://pineapple.io/resources/tagged/javascript?type=tutorials&sort=all_time

http://www.codeschool.com/courses/javascript-road-trip-part-1

http://www.learnstreet.com/lessons/study/javascript

Examples

Function definition:

var multiplybytwo = function (number) {
   var val = number * 2;
   console.log(val);
};


Declare a variable:

var myage = 25;


Confirm dialog:

confirm("You rock!")

Print to screen:

console.log('Hello world')


Equal to:

console.log(5 === 7)

Not equal to:

A !== B


If:

if condition //if  condition is true
{
 execute some code
}

If/else:

if condition
{
    execute some code
}
else
{
execute some other code
}

Substrings:

"wonderful day".substring(3,7)

Class prototypes:

Inheritance:

Penguin.prototype = new Animal();

Extending the prototype:

classname.prototype = function(){...new function...}

Check if object has property:

object.hasOwnProperty(propertyname)
Personal tools