SlideShare ist ein Scribd-Unternehmen logo
1 von 68
Downloaden Sie, um offline zu lesen
Javascript 
- Javascript - 
The Good, 
the Bad and the Ugly
Javascript 
● Thorsten Suckow-Homberg 
Javascript since 1999 
Author of conjoon (http://conjoon.com) 
Trainer and consultant for Javascript and ExtJS 
Senior Software Developer eyeworkers GmbH, 
Karlsruhe 
@thorstensuckow
Javascript 
What is this talk about? 
● Javascript 
● History 
● The good (a few words) 
● The Bad (examples) 
● The Ugly (more examples)
Javascript 
„Sometimes language 
designers make mistakes.“ 
- Douglas Crockford 
http://en.wikipedia.org/wiki/Douglas_Crockford#mediaviewer/File:Douglas_Crockford.jpg
Javascript 
History 
http://de.wikipedia.org/wiki/Netscape_Communications#mediaviewer/File:Netscape_Logo.svg 
http://de.wikipedia.org/wiki/Brendan_Eich#mediaviewer/File:BEich.jpg 
http://de.wikipedia.org/wiki/AOL#mediaviewer/File:AOL_Logo.jpg 
● created by Brendan Eich, 
1995 (in 10 days) 
● shipped as „Live Script“ with 
Netscape Navigator 2.0 
● Java Hype to this time: 
Renamed to JavaScript in NN 
2.0B3 
● Microsoft adopts JS and 
introduces it with IE 3.0 
● Promotes its usage under the 
term „Dynamic HTML“ 
● Standardized as ECMAScript 
in June 1997
Javascript 
What is Javascript, anyway? 
● dynamic computer programming language 
● prototype based scripting 
● dynamic typing 
● first-class functions 
● Supporting: 
object oriented 
imperative 
functional 
programming style
Javascript 
Java (Syntax) 
Scheme 
(Functions) 
Self 
(Prototypal 
Inheritance) 
JavaScript 
Perl 
(Regular 
Expressions)
Javascript 
Teasing the Good and the Bad 
Good 
functions 
loose typing 
dynamic objects 
expressive literal object 
notation 
Bad 
programming model 
based on global variables 
„Everything is an 
Object.“ 
- Javascript 
http://edndoc.esri.com
Javascript 
Teasing the Good and the Bad – The Good 
<script type =“text/javascript“> 
var days = ['monday', 'tuesday', 
'wednesday', 'thursday', 
'friday', 'saturday', 'sunday']; 
function getDayName(dayNum) { 
return days[dayNum]; 
} 
</script>
Javascript 
Teasing the Good and the Bad – The Good 
<script type =“text/javascript“> 
function getDayName(dayNum) { 
var days = ['monday', 'tuesday', 
'wednesday', 'thursday', 
'friday', 'saturday', 'sunday']; 
return days[dayNum]; 
} 
</script>
Javascript 
Teasing the Good and the Bad – The Good 
<script type =“text/javascript“> 
var getDayName = function() { 
var days = ['monday', 'tuesday', 
'wednesday', 'thursday', 
'friday', 'saturday', 'sunday']; 
return function(dayNum) { 
return days[dayNum]; 
} 
}(); 
GetDayName(0); // > 'monday' 
</script>
Javascript 
Imperative Approach 
var otherText = „oh hai!“; 
var text = „Hello World!“; 
console.log(otherText); 
console.log(text); 
// > Oh hai! 
// > Hello World! 
http://www.retro-programming.de
Javascript 
Functional Approach 
function otherText() { 
console.log(„oh hai!“); 
} 
function text() { 
console.log(„Hello World!“); 
} 
otherText(); 
text(); 
// > Oh hai! 
// > Hello World! 
http://www.excel-live.de
Javascript 
Object Oriented Approach 
function Bar(text) { 
console.log(this.text); 
console.log(text); 
} 
Bar.prototype = { 
text : „oh hai!“ 
}; 
var foo = new Bar(„Hello World!“); 
// > Oh hai! 
// > Hello World! 
http://www.teachitza.com/delphi/oop.htm
Javascript 

 and the DOM, of course. 
http://www.technologyuk.net/the_internet/web/document_object_model.shtml
Javascript 
Teasing the Good and the Bad 
1 + „foo“ 
// > 1foo 
1 - „foo“ 
// >
Javascript 
Teasing the Good and the Bad 
1 + „foo“ 
// > 1foo 
1 - „foo“ 
// > NaN 
typeof(NaN) 
//>
Javascript 
Teasing the Good and the Bad 
1 + „foo“ 
// > 1foo 
1 - „foo“ 
// > NaN 
typeof(NaN) 
// > „number“
Javascript 
Semicolon Insertion
Javascript 
Semicolons 
„Humans make mistakes. 
Let's try to detect omitted 
semicolons and insert them 
automatically.“ 
- Javascript, 1995 
console.log(„foo“); 
console.log(„bar“) 
console.log(„oh hai!“); 
;
Javascript 
function foo() { 
return 
{ 
bar : true 
}; 
} 
var bar = foo(); 
console.log(bar); 
// > ? 
Semicolons 
;
Javascript 
function foo() { 
return 
{ 
bar : true 
}; 
} 
var bar = foo(); 
console.log(bar); 
// > undefined 
Semicolons 
;
Javascript 
function foo() { 
return 
{ 
bar : true 
}; 
} 
var bar = foo(); 
console.log(bar); 
// > undefined 
Semicolons 
; 
;
Javascript 
function foo() { 
return 
{ 
bar : true 
}; 
} 
var bar = foo(); 
console.log(bar); 
// > undefined 
Semicolons 
; 
; 
;
Javascript 
function foo() { 
return { 
bar : true 
}; 
} 
var bar = foo(); 
console.log(bar); 
// > Object {bar:true} 
Semicolons 
;
Javascript 
function foo() { 
var a = 1 
b = 2; 
} 
foo(); 
console.log(a); 
console.log(b); 
Semicolons 
;
Javascript 
function foo() { 
var a = 1 
b = 2; 
} 
foo(); 
console.log(a); 
console.log(b); 
// > Reference Error 
// > 2 
Semicolons 
;
Javascript 
Equality Operators
Javascript 
0 == '0' 
Equality Operators 
= 
== 
=== 
!= 
!==
Javascript 
0 == '0' // true 
0 === '0' 
Equality Operators 
== 
=== 
!= 
!==
Javascript 
0 == '0' // true 
0 === '0' // false 
0 == '' 
Equality Operators 
== 
=== 
!= 
!==
Javascript 
0 == '0' // true 
0 === '0' // false 
0 == '' // true 
'' == '0' 
Equality Operators 
== 
=== 
!= 
!==
Javascript 
0 == '0' // true 
0 === '0' // false 
0 == '' // true 
'' == '0' // false 
false == 'false' 
Equality Operators 
== 
=== 
!= 
!==
Javascript 
0 == '0' // true 
0 === '0' // false 
0 == '' // true 
'' == '0' // false 
false == 'false' // false 
false == '0' 
Equality Operators 
== 
=== 
!= 
!==
Javascript 
0 == '0' // true 
0 === '0' // false 
0 == '' // true 
'' == '0' // false 
false == 'false' // false 
false == '0' // true 
Equality Operators 
== 
=== 
!= 
!==
Javascript 
'' == false // true 
false == '0' // true 
'' == '0' // ? 
Equality Operators 
== 
=== 
!= 
!==
Javascript 
'' == false // true 
false == '0' // true 
'' == '0' // ? 
'' => false => '0' 
'' == '0' // ?!?!? 
Equality Operators 
== 
=== 
!= 
!==
Javascript 
'' == false // true 
false == '0' // true 
'' == '0' // ? 
'' => false =>'0' 
'' == '0' // false 
Equality Operators 
== 
=== 
!= 
!==
Javascript 
Equality Operators 
== 
!= 
=== 
!== 
Expected '===' and instead saw '=='.
Javascript 
Arrays
foo = [1, 2, 3, 4]; 
bar = new Array(1, 2, 3, 4); 
Javascript 
Arrays 
var foo = []; 
var bar = new Array();
foo = [1, 2, 3, 4]; 
bar = new Array(1, 2, 3, 4); 
Javascript 
foo[0] = 1; 
foo[1] = 2; 
foo[2] = 3; 
foo[3] = 4; 
// > foo.length == 4 
Arrays 
var foo = []; 
var bar = new Array();
Javascript 
foo = []; 
foo[11203] = 1; 
// > foo.length == ? 
Arrays 
var foo = []; 
var bar = new Array();
Javascript 
foo = []; 
foo[11203] = 1; 
// > foo.length == 11204 
Arrays 
var foo = []; 
var bar = new Array();
Javascript 
foo = new Array(1, 2); 
console.log(foo); 
// > ? 
Arrays 
var foo = []; 
var bar = new Array();
Javascript 
foo = new Array(1, 2); 
console.log(foo); 
// > [1, 2] 
Arrays 
var foo = []; 
var bar = new Array();
Javascript 
foo = new Array(1, 2); 
console.log(foo); 
// > [1, 2] 
bar = new Array(2); 
console.log(bar); 
// > ? 
Arrays 
var foo = []; 
var bar = new Array();
Javascript 
foo = new Array(1, 2); 
console.log(foo); 
// > [1, 2] 
bar = new Array(2); 
console.log(bar); 
// > [undefined, undefined] 
Arrays 
var foo = []; 
var bar = new Array();
Javascript 
foo == true // ? 
Arrays 
var foo = []; 
var bar = new Array();
Javascript 
foo == true // false 
Arrays 
var foo = []; 
var bar = new Array(); 
var txt = ''; 
if (foo) { 
txt = 1; 
} else { 
txt = 2; 
} 
console.log(txt);
Javascript 
foo == true // false 
Arrays 
var foo = []; 
var bar = new Array(); 
var txt = ''; 
if (foo) { 
txt = 1; 
} else { 
txt = 2; 
} 
console.log(txt); 
// > 1
Javascript 
Prototyping
Javascript 
Prototyping 
var Foo = function() { 
}; 
Foo.prototype.i = 0; 
Foo.prototype.bar = new Array(0, 1); 
var wobble = new Foo; 
console.log(wobble.i); // 0 
console.log(wobble.bar[0]); // 0 
wobble.i = 1; 
wobble.bar[0] = 2; 
console.log(wobble.i); // 1 
console.log(wobble.bar[0]); // 2 
var wibble = new Foo; 
console.log(wibble.i); 
console.log(wibble.bar[0]); 
// > ?
Javascript 
Prototyping 
var Foo = function() { 
}; 
Foo.prototype.i = 0; 
Foo.prototype.bar = new Array(0, 1); 
var wobble = new Foo; 
console.log(wobble.i); // 0 
console.log(wobble.bar[0]); // 0 
wobble.i = 1; 
wobble.bar[0] = 2; 
console.log(wobble.i); // 1 
console.log(wobble.bar[0]); // 2 
var wibble = new Foo; 
console.log(wibble.i, wibble.bar[0]); 
// > 0, 2
Javascript 
Prototyping 
var Foo = function() { 
}; 
Foo.prototype.i = 0; 
Foo.prototype.bar = new Array(0, 1); 
var wobble = new Foo; 
console.log(wobble.i); // 0 
console.log(wobble.bar[0]); // 0 
wobble.i = 1; 
wobble.bar[0] = 2; 
console.log(wobble.i); // 1 
console.log(wobble.bar[0]); // 2 
var wibble = new Foo; 
console.log(wibble.i, wibble.bar[0]); 
// > 0, 2 
Foo.prototype.bar 
wibble wobble
Summary: 
In this episode, Sheldon defines a Function 
and its prototype. While Leonard invokes the 
function and creates a new object of it, 
Howard changes the prototype. 
In the meantime, Rajesh relies on Howard's 
previously created object... 
Penny just leans back and watches as all hell 
breaks loose... 
Will they ever figure out what happened? 
Javascript 
The BigBang Javascript Theory 
Season 08 Episode 15: 
The Viktor Paradoxon 
Summary: 
In this episode, Sheldon defines a Function 
and its prototype. While Leonard invokes the 
function and creates a new object of it, 
Howard changes the prototype. 
In the meantime, Rajesh relies on Howard's 
previously created object... 
Penny just leans back and watches as all hell 
breaks loose... 
Will they ever figure out what happened?
Javascript 
Prototyping 
var Foo = function() { 
}; 
Foo.prototype.i = 0; 
var wobble = new Foo; 
console.log(wobble.i); 
Foo.prototype.i = 2; 
var wibble = new Foo; 
console.log(wobble.i, wibble.i); 
// > ? 
// > ?
Javascript 
Prototyping 
var Foo = function() { 
}; 
Foo.prototype.i = 0; 
var wobble = new Foo; 
console.log(wobble.i); 
Foo.prototype.i = 2; 
var wibble = new Foo; 
console.log(wobble.i, wibble.i); 
// > 0 
// > 2, 2
Javascript 
WAT?
true false 
Javascript 
Prototyping 
var Foo = function() { 
}; 
Foo.prototype.i = 0; 
var wobble = new Foo; 
console.log(wobble.i); 
Foo.prototype.i = 2; 
var wibble = new Foo; 
console.log(wobble.i, wibble.i); 
// > 0 
// > 2, 2 
wibble.i === undefined 
Foo.prototype.i === 
undefined 
wibble.i 
true false 
Object.prototype.i === Foo.prototype.i 
undefined 
true false 
undefined Object.prototype.i
Javascript 
DOM
Javascript 
DOM 
<html> 
<head></head> 
<body> 
<div id="foo"></div> 
<div id="bar"></div> 
</body> 
</html> 
console.log(foo); 
// > ?
Javascript 
DOM 
console.log(foo); 
// > <div id=“foo“> 
<html> 
<head></head> 
<body> 
<div id="foo"></div> 
<div id="bar"></div> 
</body> 
</html>
Javascript 
DOM 
console.log(foo); 
// > <div id=“foo“> 
foo.innerHTML = 'bar' 
// > <div id=“foo“>bar</div> 
<html> 
<head></head> 
<body> 
<div id="foo"></div> 
<div id="bar"></div> 
</body> 
</html>
Javascript 
DOM 
console.log(foo); 
foo.innerHTML = 'bar' 
var foo = 'bar'; 
// > ? 
<html> 
<head></head> 
<body> 
<div id="foo"></div> 
<div id="bar"></div> 
</body> 
</html>
Javascript 
DOM 
console.log(foo); 
foo.innerHTML = 'bar' 
var foo = 'bar'; 
// > TypeError: foo is 
// undefined 
<html> 
<head></head> 
<body> 
<div id="foo"></div> 
<div id="bar"></div> 
</body> 
</html>
Javascript 
● Building Ext JS 5 apps with Sencha 
Architect 
● Testing Ext JS 5 applications with 
Siesta 
● Javascript – The good, the bad and 
the ugly & Improving Ext JS app 
performance. 
● Optimizing your current Ext JS 
applications for touch and tablets 
● Building Custom UI Components 
With Ext JS 5 
● Delivering a great user experience 
with Ext JS 5 
● How to secure your data with 
Sencha Space 
2014/12/02 Karlsruhe, Germany 
http://senchaday.de
Javascript 
Thank You!

Weitere Àhnliche Inhalte

Was ist angesagt?

Adding ES6 to Your Developer Toolbox
Adding ES6 to Your Developer ToolboxAdding ES6 to Your Developer Toolbox
Adding ES6 to Your Developer ToolboxJeff Strauss
 
JavaScript - Like a Box of Chocolates - jsDay
JavaScript - Like a Box of Chocolates - jsDayJavaScript - Like a Box of Chocolates - jsDay
JavaScript - Like a Box of Chocolates - jsDayRobert Nyman
 
ES6 PPT FOR 2016
ES6 PPT FOR 2016ES6 PPT FOR 2016
ES6 PPT FOR 2016Manoj Kumar
 
ÂżCĂłmo de sexy puede hacer Backbone mi cĂłdigo?
ÂżCĂłmo de sexy puede hacer Backbone mi cĂłdigo?ÂżCĂłmo de sexy puede hacer Backbone mi cĂłdigo?
ÂżCĂłmo de sexy puede hacer Backbone mi cĂłdigo?jaespinmora
 
To Err Is Human
To Err Is HumanTo Err Is Human
To Err Is HumanAlex Liu
 
Ember background basics
Ember background basicsEmber background basics
Ember background basicsPhilipp Fehre
 
Turn your spaghetti code into ravioli with JavaScript modules
Turn your spaghetti code into ravioli with JavaScript modulesTurn your spaghetti code into ravioli with JavaScript modules
Turn your spaghetti code into ravioli with JavaScript modulesjerryorr
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testingVisual Engineering
 
7ᄌᅼ JavaScript 싀슔
7ᄌᅼ JavaScript 싀슔7ᄌᅼ JavaScript 싀슔
7ᄌᅼ JavaScript 싀슔지수 윀
 
Getting started with ES6 : Future of javascript
Getting started with ES6 : Future of javascriptGetting started with ES6 : Future of javascript
Getting started with ES6 : Future of javascriptMohd Saeed
 
Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6Visual Engineering
 
meet.js - QooXDoo
meet.js - QooXDoomeet.js - QooXDoo
meet.js - QooXDooRadek Benkel
 
TDC 2014 - JavaScript de qualidade: hoje, amanhĂŁ e sempre!
TDC 2014 - JavaScript de qualidade: hoje, amanhĂŁ e sempre!TDC 2014 - JavaScript de qualidade: hoje, amanhĂŁ e sempre!
TDC 2014 - JavaScript de qualidade: hoje, amanhĂŁ e sempre!Guilherme Carreiro
 
PHP Object Injection Vulnerability in WordPress: an Analysis
PHP Object Injection Vulnerability in WordPress: an AnalysisPHP Object Injection Vulnerability in WordPress: an Analysis
PHP Object Injection Vulnerability in WordPress: an AnalysisPositive Hack Days
 
Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.boyney123
 
ES6 - Level up your JavaScript Skills
ES6 - Level up your JavaScript SkillsES6 - Level up your JavaScript Skills
ES6 - Level up your JavaScript SkillsStefano Ceschi Berrini
 
Security Meetup 22 ĐŸĐșŃ‚ŃĐ±Ń€Ń. «РДĐČДрс-ĐžĐœĐ¶ĐžĐœĐžŃ€ĐžĐœĐł ĐČ Enterprise». АлДĐșсДĐč ĐĄĐ”ĐșŃ€Đ”Ń‚ĐŸ...
Security Meetup 22 ĐŸĐșŃ‚ŃĐ±Ń€Ń. «РДĐČДрс-ĐžĐœĐ¶ĐžĐœĐžŃ€ĐžĐœĐł ĐČ Enterprise». АлДĐșсДĐč ĐĄĐ”ĐșŃ€Đ”Ń‚ĐŸ...Security Meetup 22 ĐŸĐșŃ‚ŃĐ±Ń€Ń. «РДĐČДрс-ĐžĐœĐ¶ĐžĐœĐžŃ€ĐžĐœĐł ĐČ Enterprise». АлДĐșсДĐč ĐĄĐ”ĐșŃ€Đ”Ń‚ĐŸ...
Security Meetup 22 ĐŸĐșŃ‚ŃĐ±Ń€Ń. «РДĐČДрс-ĐžĐœĐ¶ĐžĐœĐžŃ€ĐžĐœĐł ĐČ Enterprise». АлДĐșсДĐč ĐĄĐ”ĐșŃ€Đ”Ń‚ĐŸ...Mail.ru Group
 
ES6: The Awesome Parts
ES6: The Awesome PartsES6: The Awesome Parts
ES6: The Awesome PartsDomenic Denicola
 

Was ist angesagt? (20)

Adding ES6 to Your Developer Toolbox
Adding ES6 to Your Developer ToolboxAdding ES6 to Your Developer Toolbox
Adding ES6 to Your Developer Toolbox
 
JavaScript - Like a Box of Chocolates - jsDay
JavaScript - Like a Box of Chocolates - jsDayJavaScript - Like a Box of Chocolates - jsDay
JavaScript - Like a Box of Chocolates - jsDay
 
ES6 is Nigh
ES6 is NighES6 is Nigh
ES6 is Nigh
 
ES6 PPT FOR 2016
ES6 PPT FOR 2016ES6 PPT FOR 2016
ES6 PPT FOR 2016
 
ÂżCĂłmo de sexy puede hacer Backbone mi cĂłdigo?
ÂżCĂłmo de sexy puede hacer Backbone mi cĂłdigo?ÂżCĂłmo de sexy puede hacer Backbone mi cĂłdigo?
ÂżCĂłmo de sexy puede hacer Backbone mi cĂłdigo?
 
To Err Is Human
To Err Is HumanTo Err Is Human
To Err Is Human
 
Ember background basics
Ember background basicsEmber background basics
Ember background basics
 
Turn your spaghetti code into ravioli with JavaScript modules
Turn your spaghetti code into ravioli with JavaScript modulesTurn your spaghetti code into ravioli with JavaScript modules
Turn your spaghetti code into ravioli with JavaScript modules
 
Sprockets
SprocketsSprockets
Sprockets
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
 
7ᄌᅼ JavaScript 싀슔
7ᄌᅼ JavaScript 싀슔7ᄌᅼ JavaScript 싀슔
7ᄌᅼ JavaScript 싀슔
 
Getting started with ES6 : Future of javascript
Getting started with ES6 : Future of javascriptGetting started with ES6 : Future of javascript
Getting started with ES6 : Future of javascript
 
Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6
 
meet.js - QooXDoo
meet.js - QooXDoomeet.js - QooXDoo
meet.js - QooXDoo
 
TDC 2014 - JavaScript de qualidade: hoje, amanhĂŁ e sempre!
TDC 2014 - JavaScript de qualidade: hoje, amanhĂŁ e sempre!TDC 2014 - JavaScript de qualidade: hoje, amanhĂŁ e sempre!
TDC 2014 - JavaScript de qualidade: hoje, amanhĂŁ e sempre!
 
PHP Object Injection Vulnerability in WordPress: an Analysis
PHP Object Injection Vulnerability in WordPress: an AnalysisPHP Object Injection Vulnerability in WordPress: an Analysis
PHP Object Injection Vulnerability in WordPress: an Analysis
 
Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.
 
ES6 - Level up your JavaScript Skills
ES6 - Level up your JavaScript SkillsES6 - Level up your JavaScript Skills
ES6 - Level up your JavaScript Skills
 
Security Meetup 22 ĐŸĐșŃ‚ŃĐ±Ń€Ń. «РДĐČДрс-ĐžĐœĐ¶ĐžĐœĐžŃ€ĐžĐœĐł ĐČ Enterprise». АлДĐșсДĐč ĐĄĐ”ĐșŃ€Đ”Ń‚ĐŸ...
Security Meetup 22 ĐŸĐșŃ‚ŃĐ±Ń€Ń. «РДĐČДрс-ĐžĐœĐ¶ĐžĐœĐžŃ€ĐžĐœĐł ĐČ Enterprise». АлДĐșсДĐč ĐĄĐ”ĐșŃ€Đ”Ń‚ĐŸ...Security Meetup 22 ĐŸĐșŃ‚ŃĐ±Ń€Ń. «РДĐČДрс-ĐžĐœĐ¶ĐžĐœĐžŃ€ĐžĐœĐł ĐČ Enterprise». АлДĐșсДĐč ĐĄĐ”ĐșŃ€Đ”Ń‚ĐŸ...
Security Meetup 22 ĐŸĐșŃ‚ŃĐ±Ń€Ń. «РДĐČДрс-ĐžĐœĐ¶ĐžĐœĐžŃ€ĐžĐœĐł ĐČ Enterprise». АлДĐșсДĐč ĐĄĐ”ĐșŃ€Đ”Ń‚ĐŸ...
 
ES6: The Awesome Parts
ES6: The Awesome PartsES6: The Awesome Parts
ES6: The Awesome Parts
 

Andere mochten auch

CSS Frameworks: Faster Layout, Consistent Results
CSS Frameworks: Faster Layout, Consistent ResultsCSS Frameworks: Faster Layout, Consistent Results
CSS Frameworks: Faster Layout, Consistent ResultsSteve Hong
 
Victoria's Secret Angels Campaign
Victoria's Secret Angels CampaignVictoria's Secret Angels Campaign
Victoria's Secret Angels CampaignJohn White
 
Connect2016 - 1172 Shipping domino
Connect2016 - 1172 Shipping dominoConnect2016 - 1172 Shipping domino
Connect2016 - 1172 Shipping dominoMatteo Bisi
 
Lotus Notes: Live Long and Prosper
Lotus Notes: Live Long and ProsperLotus Notes: Live Long and Prosper
Lotus Notes: Live Long and ProsperPeter Presnell
 
If톔음읎된닀멎..팜플렛
If톔음읎된닀멎..팜플렛If톔음읎된닀멎..팜플렛
If톔음읎된닀멎..팜플렛톔음부
 
A World Without Applications
A World Without ApplicationsA World Without Applications
A World Without ApplicationsRed Pill Now
 
IBM Presents the IBM Notes and Domino Roadmap
IBM Presents the IBM Notes and Domino RoadmapIBM Presents the IBM Notes and Domino Roadmap
IBM Presents the IBM Notes and Domino RoadmapTeamstudio
 

Andere mochten auch (7)

CSS Frameworks: Faster Layout, Consistent Results
CSS Frameworks: Faster Layout, Consistent ResultsCSS Frameworks: Faster Layout, Consistent Results
CSS Frameworks: Faster Layout, Consistent Results
 
Victoria's Secret Angels Campaign
Victoria's Secret Angels CampaignVictoria's Secret Angels Campaign
Victoria's Secret Angels Campaign
 
Connect2016 - 1172 Shipping domino
Connect2016 - 1172 Shipping dominoConnect2016 - 1172 Shipping domino
Connect2016 - 1172 Shipping domino
 
Lotus Notes: Live Long and Prosper
Lotus Notes: Live Long and ProsperLotus Notes: Live Long and Prosper
Lotus Notes: Live Long and Prosper
 
If톔음읎된닀멎..팜플렛
If톔음읎된닀멎..팜플렛If톔음읎된닀멎..팜플렛
If톔음읎된닀멎..팜플렛
 
A World Without Applications
A World Without ApplicationsA World Without Applications
A World Without Applications
 
IBM Presents the IBM Notes and Domino Roadmap
IBM Presents the IBM Notes and Domino RoadmapIBM Presents the IBM Notes and Domino Roadmap
IBM Presents the IBM Notes and Domino Roadmap
 

Ähnlich wie Javascript - The Good, the Bad and the Ugly

Bestpractices nl
Bestpractices nlBestpractices nl
Bestpractices nlWilfred Nas
 
JavaScript ES6
JavaScript ES6JavaScript ES6
JavaScript ES6Leo Hernandez
 
Workshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptWorkshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptVisual Engineering
 
2013-06-15 - Software Craftsmanship mit JavaScript
2013-06-15 - Software Craftsmanship mit JavaScript2013-06-15 - Software Craftsmanship mit JavaScript
2013-06-15 - Software Craftsmanship mit JavaScriptJohannes Hoppe
 
2013-06-24 - Software Craftsmanship with JavaScript
2013-06-24 - Software Craftsmanship with JavaScript2013-06-24 - Software Craftsmanship with JavaScript
2013-06-24 - Software Craftsmanship with JavaScriptJohannes Hoppe
 
ES6: The future is now
ES6: The future is nowES6: The future is now
ES6: The future is nowSebastiano Armeli
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developersStoyan Stefanov
 
Avinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPressAvinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPresswpnepal
 
JavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talkJavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talkThomas Kjeldahl Nilsson
 
Security Challenges in Node.js
Security Challenges in Node.jsSecurity Challenges in Node.js
Security Challenges in Node.jsWebsecurify
 
ă‚”ă‚€æœŹ 文
ă‚”ă‚€æœŹ æ–‡ă‚”ă‚€æœŹ 文
ă‚”ă‚€æœŹ 文Takashi Takizawa
 
Orlando BarCamp Why Javascript Doesn't Suck
Orlando BarCamp Why Javascript Doesn't SuckOrlando BarCamp Why Javascript Doesn't Suck
Orlando BarCamp Why Javascript Doesn't Suckerockendude
 
[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?Radek Benkel
 
Java script for web developer
Java script for web developerJava script for web developer
Java script for web developerChalermpon Areepong
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
Java & Script ─ 枅矜
Java & Script ─ 枅矜Java & Script ─ 枅矜
Java & Script ─ 枅矜taobao.com
 
Stuff you didn't know about action script
Stuff you didn't know about action scriptStuff you didn't know about action script
Stuff you didn't know about action scriptChristophe Herreman
 

Ähnlich wie Javascript - The Good, the Bad and the Ugly (20)

Bestpractices nl
Bestpractices nlBestpractices nl
Bestpractices nl
 
JavaScript ES6
JavaScript ES6JavaScript ES6
JavaScript ES6
 
Workshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptWorkshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScript
 
"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues
 
2013-06-15 - Software Craftsmanship mit JavaScript
2013-06-15 - Software Craftsmanship mit JavaScript2013-06-15 - Software Craftsmanship mit JavaScript
2013-06-15 - Software Craftsmanship mit JavaScript
 
2013-06-24 - Software Craftsmanship with JavaScript
2013-06-24 - Software Craftsmanship with JavaScript2013-06-24 - Software Craftsmanship with JavaScript
2013-06-24 - Software Craftsmanship with JavaScript
 
ES6: The future is now
ES6: The future is nowES6: The future is now
ES6: The future is now
 
Javascript essentials
Javascript essentialsJavascript essentials
Javascript essentials
 
JavaScript for PHP developers
JavaScript for PHP developersJavaScript for PHP developers
JavaScript for PHP developers
 
Avinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPressAvinash Kundaliya: Javascript and WordPress
Avinash Kundaliya: Javascript and WordPress
 
JavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talkJavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talk
 
Security Challenges in Node.js
Security Challenges in Node.jsSecurity Challenges in Node.js
Security Challenges in Node.js
 
ă‚”ă‚€æœŹ 文
ă‚”ă‚€æœŹ æ–‡ă‚”ă‚€æœŹ 文
ă‚”ă‚€æœŹ 文
 
Orlando BarCamp Why Javascript Doesn't Suck
Orlando BarCamp Why Javascript Doesn't SuckOrlando BarCamp Why Javascript Doesn't Suck
Orlando BarCamp Why Javascript Doesn't Suck
 
[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?
 
JavaScript Primer
JavaScript PrimerJavaScript Primer
JavaScript Primer
 
Java script for web developer
Java script for web developerJava script for web developer
Java script for web developer
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Java & Script ─ 枅矜
Java & Script ─ 枅矜Java & Script ─ 枅矜
Java & Script ─ 枅矜
 
Stuff you didn't know about action script
Stuff you didn't know about action scriptStuff you didn't know about action script
Stuff you didn't know about action script
 

Mehr von Thorsten Suckow-Homberg

conjoon - The Open Source Webmail Client
conjoon - The Open Source Webmail Clientconjoon - The Open Source Webmail Client
conjoon - The Open Source Webmail ClientThorsten Suckow-Homberg
 
Practices and obstacles in agile development
Practices and obstacles in agile developmentPractices and obstacles in agile development
Practices and obstacles in agile developmentThorsten Suckow-Homberg
 
Webcon 2012 Mobile Development mit Sencha Touch
Webcon 2012  Mobile Development mit Sencha TouchWebcon 2012  Mobile Development mit Sencha Touch
Webcon 2012 Mobile Development mit Sencha TouchThorsten Suckow-Homberg
 

Mehr von Thorsten Suckow-Homberg (6)

Introduction to ExtJs 5
Introduction to ExtJs 5Introduction to ExtJs 5
Introduction to ExtJs 5
 
conjoon - The Open Source Webmail Client
conjoon - The Open Source Webmail Clientconjoon - The Open Source Webmail Client
conjoon - The Open Source Webmail Client
 
Einfuehrung in ExtJS 4
Einfuehrung in ExtJS 4Einfuehrung in ExtJS 4
Einfuehrung in ExtJS 4
 
Practices and obstacles in agile development
Practices and obstacles in agile developmentPractices and obstacles in agile development
Practices and obstacles in agile development
 
Webcon 2012 Mobile Development mit Sencha Touch
Webcon 2012  Mobile Development mit Sencha TouchWebcon 2012  Mobile Development mit Sencha Touch
Webcon 2012 Mobile Development mit Sencha Touch
 
Zend Framework MVC driven ExtJS
Zend Framework MVC driven ExtJSZend Framework MVC driven ExtJS
Zend Framework MVC driven ExtJS
 

KĂŒrzlich hochgeladen

Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 

KĂŒrzlich hochgeladen (20)

Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

Javascript - The Good, the Bad and the Ugly

  • 1. Javascript - Javascript - The Good, the Bad and the Ugly
  • 2. Javascript ● Thorsten Suckow-Homberg Javascript since 1999 Author of conjoon (http://conjoon.com) Trainer and consultant for Javascript and ExtJS Senior Software Developer eyeworkers GmbH, Karlsruhe @thorstensuckow
  • 3. Javascript What is this talk about? ● Javascript ● History ● The good (a few words) ● The Bad (examples) ● The Ugly (more examples)
  • 4. Javascript „Sometimes language designers make mistakes.“ - Douglas Crockford http://en.wikipedia.org/wiki/Douglas_Crockford#mediaviewer/File:Douglas_Crockford.jpg
  • 5. Javascript History http://de.wikipedia.org/wiki/Netscape_Communications#mediaviewer/File:Netscape_Logo.svg http://de.wikipedia.org/wiki/Brendan_Eich#mediaviewer/File:BEich.jpg http://de.wikipedia.org/wiki/AOL#mediaviewer/File:AOL_Logo.jpg ● created by Brendan Eich, 1995 (in 10 days) ● shipped as „Live Script“ with Netscape Navigator 2.0 ● Java Hype to this time: Renamed to JavaScript in NN 2.0B3 ● Microsoft adopts JS and introduces it with IE 3.0 ● Promotes its usage under the term „Dynamic HTML“ ● Standardized as ECMAScript in June 1997
  • 6. Javascript What is Javascript, anyway? ● dynamic computer programming language ● prototype based scripting ● dynamic typing ● first-class functions ● Supporting: object oriented imperative functional programming style
  • 7. Javascript Java (Syntax) Scheme (Functions) Self (Prototypal Inheritance) JavaScript Perl (Regular Expressions)
  • 8. Javascript Teasing the Good and the Bad Good functions loose typing dynamic objects expressive literal object notation Bad programming model based on global variables „Everything is an Object.“ - Javascript http://edndoc.esri.com
  • 9. Javascript Teasing the Good and the Bad – The Good <script type =“text/javascript“> var days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']; function getDayName(dayNum) { return days[dayNum]; } </script>
  • 10. Javascript Teasing the Good and the Bad – The Good <script type =“text/javascript“> function getDayName(dayNum) { var days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']; return days[dayNum]; } </script>
  • 11. Javascript Teasing the Good and the Bad – The Good <script type =“text/javascript“> var getDayName = function() { var days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']; return function(dayNum) { return days[dayNum]; } }(); GetDayName(0); // > 'monday' </script>
  • 12. Javascript Imperative Approach var otherText = „oh hai!“; var text = „Hello World!“; console.log(otherText); console.log(text); // > Oh hai! // > Hello World! http://www.retro-programming.de
  • 13. Javascript Functional Approach function otherText() { console.log(„oh hai!“); } function text() { console.log(„Hello World!“); } otherText(); text(); // > Oh hai! // > Hello World! http://www.excel-live.de
  • 14. Javascript Object Oriented Approach function Bar(text) { console.log(this.text); console.log(text); } Bar.prototype = { text : „oh hai!“ }; var foo = new Bar(„Hello World!“); // > Oh hai! // > Hello World! http://www.teachitza.com/delphi/oop.htm
  • 15. Javascript 
 and the DOM, of course. http://www.technologyuk.net/the_internet/web/document_object_model.shtml
  • 16. Javascript Teasing the Good and the Bad 1 + „foo“ // > 1foo 1 - „foo“ // >
  • 17. Javascript Teasing the Good and the Bad 1 + „foo“ // > 1foo 1 - „foo“ // > NaN typeof(NaN) //>
  • 18. Javascript Teasing the Good and the Bad 1 + „foo“ // > 1foo 1 - „foo“ // > NaN typeof(NaN) // > „number“
  • 20. Javascript Semicolons „Humans make mistakes. Let's try to detect omitted semicolons and insert them automatically.“ - Javascript, 1995 console.log(„foo“); console.log(„bar“) console.log(„oh hai!“); ;
  • 21. Javascript function foo() { return { bar : true }; } var bar = foo(); console.log(bar); // > ? Semicolons ;
  • 22. Javascript function foo() { return { bar : true }; } var bar = foo(); console.log(bar); // > undefined Semicolons ;
  • 23. Javascript function foo() { return { bar : true }; } var bar = foo(); console.log(bar); // > undefined Semicolons ; ;
  • 24. Javascript function foo() { return { bar : true }; } var bar = foo(); console.log(bar); // > undefined Semicolons ; ; ;
  • 25. Javascript function foo() { return { bar : true }; } var bar = foo(); console.log(bar); // > Object {bar:true} Semicolons ;
  • 26. Javascript function foo() { var a = 1 b = 2; } foo(); console.log(a); console.log(b); Semicolons ;
  • 27. Javascript function foo() { var a = 1 b = 2; } foo(); console.log(a); console.log(b); // > Reference Error // > 2 Semicolons ;
  • 29. Javascript 0 == '0' Equality Operators = == === != !==
  • 30. Javascript 0 == '0' // true 0 === '0' Equality Operators == === != !==
  • 31. Javascript 0 == '0' // true 0 === '0' // false 0 == '' Equality Operators == === != !==
  • 32. Javascript 0 == '0' // true 0 === '0' // false 0 == '' // true '' == '0' Equality Operators == === != !==
  • 33. Javascript 0 == '0' // true 0 === '0' // false 0 == '' // true '' == '0' // false false == 'false' Equality Operators == === != !==
  • 34. Javascript 0 == '0' // true 0 === '0' // false 0 == '' // true '' == '0' // false false == 'false' // false false == '0' Equality Operators == === != !==
  • 35. Javascript 0 == '0' // true 0 === '0' // false 0 == '' // true '' == '0' // false false == 'false' // false false == '0' // true Equality Operators == === != !==
  • 36. Javascript '' == false // true false == '0' // true '' == '0' // ? Equality Operators == === != !==
  • 37. Javascript '' == false // true false == '0' // true '' == '0' // ? '' => false => '0' '' == '0' // ?!?!? Equality Operators == === != !==
  • 38. Javascript '' == false // true false == '0' // true '' == '0' // ? '' => false =>'0' '' == '0' // false Equality Operators == === != !==
  • 39. Javascript Equality Operators == != === !== Expected '===' and instead saw '=='.
  • 41. foo = [1, 2, 3, 4]; bar = new Array(1, 2, 3, 4); Javascript Arrays var foo = []; var bar = new Array();
  • 42. foo = [1, 2, 3, 4]; bar = new Array(1, 2, 3, 4); Javascript foo[0] = 1; foo[1] = 2; foo[2] = 3; foo[3] = 4; // > foo.length == 4 Arrays var foo = []; var bar = new Array();
  • 43. Javascript foo = []; foo[11203] = 1; // > foo.length == ? Arrays var foo = []; var bar = new Array();
  • 44. Javascript foo = []; foo[11203] = 1; // > foo.length == 11204 Arrays var foo = []; var bar = new Array();
  • 45. Javascript foo = new Array(1, 2); console.log(foo); // > ? Arrays var foo = []; var bar = new Array();
  • 46. Javascript foo = new Array(1, 2); console.log(foo); // > [1, 2] Arrays var foo = []; var bar = new Array();
  • 47. Javascript foo = new Array(1, 2); console.log(foo); // > [1, 2] bar = new Array(2); console.log(bar); // > ? Arrays var foo = []; var bar = new Array();
  • 48. Javascript foo = new Array(1, 2); console.log(foo); // > [1, 2] bar = new Array(2); console.log(bar); // > [undefined, undefined] Arrays var foo = []; var bar = new Array();
  • 49. Javascript foo == true // ? Arrays var foo = []; var bar = new Array();
  • 50. Javascript foo == true // false Arrays var foo = []; var bar = new Array(); var txt = ''; if (foo) { txt = 1; } else { txt = 2; } console.log(txt);
  • 51. Javascript foo == true // false Arrays var foo = []; var bar = new Array(); var txt = ''; if (foo) { txt = 1; } else { txt = 2; } console.log(txt); // > 1
  • 53. Javascript Prototyping var Foo = function() { }; Foo.prototype.i = 0; Foo.prototype.bar = new Array(0, 1); var wobble = new Foo; console.log(wobble.i); // 0 console.log(wobble.bar[0]); // 0 wobble.i = 1; wobble.bar[0] = 2; console.log(wobble.i); // 1 console.log(wobble.bar[0]); // 2 var wibble = new Foo; console.log(wibble.i); console.log(wibble.bar[0]); // > ?
  • 54. Javascript Prototyping var Foo = function() { }; Foo.prototype.i = 0; Foo.prototype.bar = new Array(0, 1); var wobble = new Foo; console.log(wobble.i); // 0 console.log(wobble.bar[0]); // 0 wobble.i = 1; wobble.bar[0] = 2; console.log(wobble.i); // 1 console.log(wobble.bar[0]); // 2 var wibble = new Foo; console.log(wibble.i, wibble.bar[0]); // > 0, 2
  • 55. Javascript Prototyping var Foo = function() { }; Foo.prototype.i = 0; Foo.prototype.bar = new Array(0, 1); var wobble = new Foo; console.log(wobble.i); // 0 console.log(wobble.bar[0]); // 0 wobble.i = 1; wobble.bar[0] = 2; console.log(wobble.i); // 1 console.log(wobble.bar[0]); // 2 var wibble = new Foo; console.log(wibble.i, wibble.bar[0]); // > 0, 2 Foo.prototype.bar wibble wobble
  • 56. Summary: In this episode, Sheldon defines a Function and its prototype. While Leonard invokes the function and creates a new object of it, Howard changes the prototype. In the meantime, Rajesh relies on Howard's previously created object... Penny just leans back and watches as all hell breaks loose... Will they ever figure out what happened? Javascript The BigBang Javascript Theory Season 08 Episode 15: The Viktor Paradoxon Summary: In this episode, Sheldon defines a Function and its prototype. While Leonard invokes the function and creates a new object of it, Howard changes the prototype. In the meantime, Rajesh relies on Howard's previously created object... Penny just leans back and watches as all hell breaks loose... Will they ever figure out what happened?
  • 57. Javascript Prototyping var Foo = function() { }; Foo.prototype.i = 0; var wobble = new Foo; console.log(wobble.i); Foo.prototype.i = 2; var wibble = new Foo; console.log(wobble.i, wibble.i); // > ? // > ?
  • 58. Javascript Prototyping var Foo = function() { }; Foo.prototype.i = 0; var wobble = new Foo; console.log(wobble.i); Foo.prototype.i = 2; var wibble = new Foo; console.log(wobble.i, wibble.i); // > 0 // > 2, 2
  • 60. true false Javascript Prototyping var Foo = function() { }; Foo.prototype.i = 0; var wobble = new Foo; console.log(wobble.i); Foo.prototype.i = 2; var wibble = new Foo; console.log(wobble.i, wibble.i); // > 0 // > 2, 2 wibble.i === undefined Foo.prototype.i === undefined wibble.i true false Object.prototype.i === Foo.prototype.i undefined true false undefined Object.prototype.i
  • 62. Javascript DOM <html> <head></head> <body> <div id="foo"></div> <div id="bar"></div> </body> </html> console.log(foo); // > ?
  • 63. Javascript DOM console.log(foo); // > <div id=“foo“> <html> <head></head> <body> <div id="foo"></div> <div id="bar"></div> </body> </html>
  • 64. Javascript DOM console.log(foo); // > <div id=“foo“> foo.innerHTML = 'bar' // > <div id=“foo“>bar</div> <html> <head></head> <body> <div id="foo"></div> <div id="bar"></div> </body> </html>
  • 65. Javascript DOM console.log(foo); foo.innerHTML = 'bar' var foo = 'bar'; // > ? <html> <head></head> <body> <div id="foo"></div> <div id="bar"></div> </body> </html>
  • 66. Javascript DOM console.log(foo); foo.innerHTML = 'bar' var foo = 'bar'; // > TypeError: foo is // undefined <html> <head></head> <body> <div id="foo"></div> <div id="bar"></div> </body> </html>
  • 67. Javascript ● Building Ext JS 5 apps with Sencha Architect ● Testing Ext JS 5 applications with Siesta ● Javascript – The good, the bad and the ugly & Improving Ext JS app performance. ● Optimizing your current Ext JS applications for touch and tablets ● Building Custom UI Components With Ext JS 5 ● Delivering a great user experience with Ext JS 5 ● How to secure your data with Sencha Space 2014/12/02 Karlsruhe, Germany http://senchaday.de