SlideShare a Scribd company logo
KnockoutJS
But first… JavaScript Bootcamp!Primitive TypesObjectsFunctionsInheritanceClosuresDesign Patterns
JavaScript != Java
IntroductionThe dominant client side programming language on the webCompletely dynamic languageImplemtations are undergoing homogenistationLibraries are just as well known as the language
Numbersvar foo = 1;
Stringsvar foo = "bar";
Booleansvar foo = true;var bar = false;
nullnull is an object
undefinednothing is defined
ObjectsEverything else in JavaScript is objectsObjects are collections of name/value pairs
Objects: Object Literalsvar foo = {};var person = {	"first-name": "Jan","last-name": "Kristiansen"};
Objects: Value retrieval>>> person["first-name"]"Jan">>> person.first-name"Jan"
Objects: Values setting>>> person.age = 24;>>> person.age24
Objects: References// References different objectsvar a = {}, b = {}, c = {}// References SAME objectvar a = b = c = {}
Objects: Deletion>>> delete person.age>>> person.age"undefined"
FunctionsFunctions are objects
Functionsvar foo = function () {	…}
Prototypal InheritanceThere are no classes in JavaScriptObjects inherit directly from other objects"Classical" inheritance still possible
Prototypal Inheritance>>> var foo = function () { this.bar = 1 };>>> var bar = function () {};>>> bar.prototype = new foo;>>> var test = new bar();>>> test.bar;1
Hiding data with closuresvar person = function (name) {this.getName = function () {	return name;};this.setName = function (newName) {	return name = newName;};};
Hiding data with closuresvar person = function (name) {this.getName = function () {	return name;};this.setName = function (newName) {	return name = newName;};};
Hiding data with closuresvar person = function (name) {this.getName = function () {	return name;};this.setName = function (newName) {	return name = newName;};};
Common design patternsFactorySingeltonModules
Module Patternvar module = function () {data = {}return {	get : function (name) {		return data[name]	},	set : function (name, value) {			data[name] = value;		return this.get(name);	}}}();
The bad partsall variables are global…a set of non-transitive equality operators…features like eval is missused…ambiguity when defining functionsno encapsulation
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

More Related Content

PDF
JavaScript LevelUp by Lee Brandt
PDF
Meetup C++ A brief overview of c++17
PDF
Icsug dev day2014_road to damascus - conversion experience-lotusscript and @f...
PPT
Prototype Js
PDF
Writing Groovy DSLs
PPT
Java 7
PDF
Justjava 2007 Arquitetura Java EE Paulo Silveira, Phillip Calçado
PPTX
Making Java Groovy (JavaOne 2013)
JavaScript LevelUp by Lee Brandt
Meetup C++ A brief overview of c++17
Icsug dev day2014_road to damascus - conversion experience-lotusscript and @f...
Prototype Js
Writing Groovy DSLs
Java 7
Justjava 2007 Arquitetura Java EE Paulo Silveira, Phillip Calçado
Making Java Groovy (JavaOne 2013)

What's hot (20)

PPTX
Introduction to Programming Bots
PDF
Invoke Dynamic
PDF
Intro python-object-protocol
PDF
Viliam Ganz - Domain Specific Languages
PDF
CJK Generation Panels Coordination Review
PDF
Js training
PPTX
Top 20 java programming interview questions for sdet
PDF
Groovyノススメ
PDF
JavaScript for Web Analysts
PPTX
SQL Saturday 28 - .NET Fundamentals
PPT
Refresher
PDF
[Question Paper] ASP.NET With C# (75:25 Pattern) [November / 2016]
PDF
メタプログラミングRuby輪読会 1-4章(復習), 5.1~5.3章
PPT
JavaScript In Object Oriented Way
PPT
Primitive Wrappers
PDF
C# 7.x What's new and what's coming with C# 8
PDF
Python 如何執行
PDF
Java objects on steroids
PDF
[Question Paper] Advanced Java (75:25 Pattern) [April / 2015]
PDF
Objective c(lang)
Introduction to Programming Bots
Invoke Dynamic
Intro python-object-protocol
Viliam Ganz - Domain Specific Languages
CJK Generation Panels Coordination Review
Js training
Top 20 java programming interview questions for sdet
Groovyノススメ
JavaScript for Web Analysts
SQL Saturday 28 - .NET Fundamentals
Refresher
[Question Paper] ASP.NET With C# (75:25 Pattern) [November / 2016]
メタプログラミングRuby輪読会 1-4章(復習), 5.1~5.3章
JavaScript In Object Oriented Way
Primitive Wrappers
C# 7.x What's new and what's coming with C# 8
Python 如何執行
Java objects on steroids
[Question Paper] Advanced Java (75:25 Pattern) [April / 2015]
Objective c(lang)
Ad

Viewers also liked (7)

PDF
HTML5 for Graduate Gathering in Steria
PDF
SharePoint 2010 Branding
PDF
SharePoint 2010 for Internet - Issues and solutions through a case study
PDF
Learn BEM: CSS Naming Convention
PDF
SEO: Getting Personal
PDF
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
HTML5 for Graduate Gathering in Steria
SharePoint 2010 Branding
SharePoint 2010 for Internet - Issues and solutions through a case study
Learn BEM: CSS Naming Convention
SEO: Getting Personal
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Ad

Similar to JavaScript Bootcamp (20)

PPTX
OO in JavaScript
PPT
Beginning Object-Oriented JavaScript
KEY
Javascript tid-bits
PPT
JavaScript Basics
PDF
The many facets of code reuse in JavaScript
PPTX
JavaScript OOPS Implimentation
PPTX
IWT presentation121232112122222225556+556.pptx
PPT
JavaScript - Programming Languages course
PPTX
Ajaxworld
PPT
Advanced JavaScript
PPTX
Object oriented javascript
PPT
JavaScript Needn't Hurt!
PDF
JavaScript Core
PDF
Design patterns in javascript
PDF
Javascript Design Patterns
PPTX
Object Oriented Javascript part2
PPTX
Framework prototype
PPTX
Framework prototype
PPTX
Framework prototype
PPT
Douglas Crockford Presentation Goodparts
OO in JavaScript
Beginning Object-Oriented JavaScript
Javascript tid-bits
JavaScript Basics
The many facets of code reuse in JavaScript
JavaScript OOPS Implimentation
IWT presentation121232112122222225556+556.pptx
JavaScript - Programming Languages course
Ajaxworld
Advanced JavaScript
Object oriented javascript
JavaScript Needn't Hurt!
JavaScript Core
Design patterns in javascript
Javascript Design Patterns
Object Oriented Javascript part2
Framework prototype
Framework prototype
Framework prototype
Douglas Crockford Presentation Goodparts

Recently uploaded (20)

PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Mushroom cultivation and it's methods.pdf
PDF
project resource management chapter-09.pdf
PPTX
A Presentation on Artificial Intelligence
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PPTX
1. Introduction to Computer Programming.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Getting Started with Data Integration: FME Form 101
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
A novel scalable deep ensemble learning framework for big data classification...
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Mushroom cultivation and it's methods.pdf
project resource management chapter-09.pdf
A Presentation on Artificial Intelligence
OMC Textile Division Presentation 2021.pptx
WOOl fibre morphology and structure.pdf for textiles
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Approach and Philosophy of On baking technology
Heart disease approach using modified random forest and particle swarm optimi...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
1. Introduction to Computer Programming.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Getting Started with Data Integration: FME Form 101
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Zenith AI: Advanced Artificial Intelligence
DP Operators-handbook-extract for the Mautical Institute
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
SOPHOS-XG Firewall Administrator PPT.pptx
A novel scalable deep ensemble learning framework for big data classification...

JavaScript Bootcamp