Your SlideShare is downloading. ×
0
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
JavaScript Bootcamp
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

JavaScript Bootcamp

1,266

Published on

A short presentation held as an introduction to JavaScript for the Microsoft department at Steria Norway. It was a prequel to my KnockoutJS presentation

A short presentation held as an introduction to JavaScript for the Microsoft department at Steria Norway. It was a prequel to my KnockoutJS presentation

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,266
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
26
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. KnockoutJS
  • 2. But first… JavaScript Bootcamp!
    Primitive Types
    Objects
    Functions
    Inheritance
    Closures
    Design Patterns
  • 3. JavaScript != Java
  • 4. Introduction
    The dominant client side programming language on the web
    Completely dynamic language
    Implemtations are undergoing homogenistation
    Libraries are just as well known as the language
  • 5. Numbers
    var foo = 1;
  • 6. Strings
    var foo = "bar";
  • 7. Booleans
    var foo = true;
    var bar = false;
  • 8. null
    null is an object
  • 9. undefined
    nothing is defined
  • 10. Objects
    Everything else in JavaScript is objects
    Objects are collections of name/value pairs
  • 11. Objects: Object Literals
    var foo = {};
    var person = {
    "first-name": "Jan",
    "last-name": "Kristiansen"
    };
  • 12. Objects: Value retrieval
    >>> person["first-name"]"Jan">>> person.first-name"Jan"
  • 13. Objects: Values setting
    >>> person.age = 24;>>> person.age24
  • 14. Objects: References
    // References different objectsvar a = {}, b = {}, c = {}// References SAME objectvar a = b = c = {}
  • 15. Objects: Deletion
    >>> delete person.age
    >>> person.age"undefined"
  • 16. Functions
    Functions are objects
  • 17. Functions
    var foo = function () {

    }
  • 18. Prototypal Inheritance
    There are no classes in JavaScript
    Objects inherit directly from other objects
    "Classical" inheritance still possible
  • 19. Prototypal Inheritance
    >>> var foo = function () { this.bar = 1 };
    >>> var bar = function () {};
    >>> bar.prototype = new foo;
    >>> var test = new bar();
    >>> test.bar;
    1
  • 20. Hiding data with closures
    var person = function (name) {
    this.getName = function () {
    return name;
    };
    this.setName = function (newName) {
    return name = newName;
    };
    };
  • 21. Hiding data with closures
    var person = function (name) {
    this.getName = function () {
    return name;
    };
    this.setName = function (newName) {
    return name = newName;
    };
    };
  • 22. Hiding data with closures
    var person = function (name) {
    this.getName = function () {
    return name;
    };
    this.setName = function (newName) {
    return name = newName;
    };
    };
  • 23. Common design patterns
    Factory
    Singelton
    Modules
  • 24. Module Pattern
    var module = function () {
    data = {}
    return {
    get : function (name) {
    return data[name]
    },
    set : function (name, value) {
    data[name] = value;
    return this.get(name);
    }
    }
    }();
  • 25. The bad parts
    all variables are global…
    a set of non-transitive equality operators…
    features like eval is missused…
    ambiguity when defining functions
    no encapsulation
  • 26. Sources
    "Private Members in JavaScript" http://www.crockford.com/javascript/private.html
    "JavaScript: The Good Parts"http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742
    "Object Oriented JavaScript"http://www.slideshare.net/mgirouard/object-oriented-javascript-1628090

×