SlideShare a Scribd company logo
danielfisher.com
JavaScript Introduction
Daniel Fisher | info@danielfisher.com
danielfisher.com
Daniel Fisher
I design, develop, deploy, teach, train, coach and
speak software.
• danielfisher.com
• HTML5 & Web
• Data Access & Performance
• Scalable & Testable Design
• Distributed Systems & Services
• Security & Trust
• justcommunity.de
• NRWConf.de
• lennybacon.com
• Blog
• @lennybacon
• Tweets
danielfisher.com
EFFICIENT COMMUNICATION…
danielfisher.com
Agenda
• History
• Usage
• Language
danielfisher.com
Introduction
• Developed by Brendan Eich
at Netscape in 1994.
– A lightweight interpreted
language
– Considered client-server
solution as a distributed OS
– Complement Java by
appealing to nonprofessional
programmers
• Like Microsoft's VB.
danielfisher.com
The Language
• JavaScript is a prototype-based scripting
language that is:
– Dynamic
– Weakly typed
– And has first-class functions.
• It is a multi-paradigm language, supporting multiple
programming styles:
– Object-oriented
– Imperative
– Functional
danielfisher.com
Adoption by Microsoft
• Internet Explorer 3.0 introduced JavaScript in
1996.
• Internet Information Server 3.0, introduced
support for server-side JavaScript in 1996.
– Microsoft's JavaScript implementation was later
renamed JScript to avoid trademark issues.
– JScript added new date methods to fix the Y2K-
problematic methods in JavaScript, which were
based on Java's java.util.Date class.
danielfisher.com
Server side JavaScript
• Netscape introduced an implementation of
the language for server-side scripting with
Netscape Enterprise Server in 1995.
– Since the mid-2000s, there has been a
proliferation of server-side JavaScript
implementations.
• node.js (2009)is one recent notable example of
server-side JavaScript being used in real-world
applications.
danielfisher.com
Standardization
• In November 1996, Netscape announced that
it had submitted JavaScript to Ecma
International for consideration as an industry
standard
– Subsequent work resulted in the standardized
version named ECMAScript.
danielfisher.com
Trademark
• Today, "JavaScript" is a trademark of Oracle
Corporation.
danielfisher.com
USAGE
danielfisher.com
Using Script
<script language="text/javascipt"></script>
<script
language="text/javascipt"
src="myExternalScript.js">
</script>
<a href="#" onclick="alert('you clicked me');">
click me
</a>
danielfisher.com
LANGUAGE
danielfisher.com
Primitive Types
• null
• Object
• Bool
• Number
• String
• Array
danielfisher.com
Complex Types
• Date
• Math
danielfisher.com
Global Objects
• undefined
• NaN
• window
• document
• navigator
danielfisher.com
Operators
+, -, *, /, %, ++, --, …
==, ===, !=, !===, <, >,
<=, >=
&&, ||, !
if, if-else, while, do, …
danielfisher.com
Variables
• Untyped!
• Can be declared with var keyword:
var foo;
• Can be created automatically by assigning a value:
foo = 1;
blah = "Hi Dave";
18
danielfisher.com
Browser UI Interaction
var yourName =
prompt('What is your name?');
if(confirm('Are you sure?')){
alert('Hello ' + yourName);
};
danielfisher.com
String
var y = "Hello World";
var len = y.length.toString();
var part = y.substring(0, 2);
var char = y.charAt(0);
var upper = y.toUpperCase();
var lower = y.toLowerCase();
danielfisher.com
Math
Math.sqrt()
Math.pow()
Math.abs()
Math.max()
Math.min()
Math.floor()
Math.ceil()
Math.round()
Math.PI()
Math.E()
Math.random()
danielfisher.com
Date
var today = new Date();
// sets to current date & time
newYear = new Date(2002, 0, 1);
newYear.getYear()
newYear.getMonth()
newYear.getDay()
newYear.getHours()
newYear.getMinutes()
newYear.getSeconds()
newYear.getMilliseconds()
danielfisher.com
The Document object
• Represents the currently loaded document
Attributes of the current document are:
– Title
– Referrer
– URL
– Images
– Forms
– Links
– Colors
23
danielfisher.com
Document Methods
• The documents methods include:
document.write()
Like a print statement – the output goes into the
HTML document.
document.writeln()
Adds a newline after printing.
document.write(
"My title is " + document.title
); 24
danielfisher.com
The Navigator Object
• Represents the browser. Read-only!
• Attributes include:
– appName
– appVersion
– platform
EIW: Javascript the Language 25
danielfisher.com
The Window object
• Methods include:
– alert()
– confirm()
– prompt()
– moveTo()
– moveBy()
– open()
– scroll()
– scrollTo()
– resizeBy()
– resizeTo()
– close()
26
danielfisher.com
The Window Methods
• Represents the current window.
• Attributes are:
– document
– name
– status
– parent
27
danielfisher.com
Comments
//Single line comment
/*
A Multi Line
Comment
*/
danielfisher.com
Arrays
var a1 = [];
var a2 = [1, 2, 4];
a2.push(5);
var x = a2.pop();
var y = a2[0];
danielfisher.com
Arrays
var a3, i, j;
a3 = [1, 2, 4];
for (i=0; i<a3.length; i++) {
a3[i]=i;
}
for (j in a3) {
document.writeln(j);
}
danielfisher.com
Javascript Functions
• The keyword function is used to define a
function (subroutine):
function add(x, y) {
return (x + y);
}
• No type is specified for arguments!
31
danielfisher.com
Functional Programming
function filter(pred, arr) {
var len = arr.length;
var filtered = [];
for(var i = 0; i < len; i++) {
var val = arr[i];
if(pred(val)) {
filtered.push(val);
}
}
return filtered;
}
var numbersGreaterThan100 =
filter(
function(x) { return (x > 100) ? true : false; },
[12, 200, 42, 11]
);
alert(numbersGreaterThan100);
danielfisher.com
BOOK DANIELFISHER.COM
READ LENNYBACON.COM
FOLLOW @LENNYBACON
LINK LINKEDIN.COM/IN/LENNYBACON
XING XING.COM/PROFILE/DANIEL_FISHER
FRIEND FB.COM/DANIEL.FISHER.LENNYBACON
MAIL DANIEL.FISHER@LENNYBACON.COM
SKYPE LENNYBACON
CALL +49 (176) 6159 8612

More Related Content

Viewers also liked (10)

PDF
Arbonne One On One
tpohawpatchoko
 
PPTX
Robots in recovery
Ye Eun Yoon
 
PPTX
2014 - DotNet UG Rhen Ruhr: Komponentenorientierung
Daniel Fisher
 
PDF
2014 - DotNetCologne: Build, Builder, Am Buildesten
Daniel Fisher
 
PPT
2005 - .NET Chaostage: 1st class data driven applications with ASP.NET 2.0
Daniel Fisher
 
PPTX
2013 - ICE Lingen: AngularJS introduction
Daniel Fisher
 
PPTX
2008 - Afterlaunch: 10 Tipps für WCF
Daniel Fisher
 
PPT
2006 - Basta!: Web 2.0 mit asp.net 2.0
Daniel Fisher
 
PPTX
2010 - Basta!: REST mit WCF 4, Silverlight und AJAX
Daniel Fisher
 
PPT
CONTRACT ENGINEERING SERVICES
ceseng
 
Arbonne One On One
tpohawpatchoko
 
Robots in recovery
Ye Eun Yoon
 
2014 - DotNet UG Rhen Ruhr: Komponentenorientierung
Daniel Fisher
 
2014 - DotNetCologne: Build, Builder, Am Buildesten
Daniel Fisher
 
2005 - .NET Chaostage: 1st class data driven applications with ASP.NET 2.0
Daniel Fisher
 
2013 - ICE Lingen: AngularJS introduction
Daniel Fisher
 
2008 - Afterlaunch: 10 Tipps für WCF
Daniel Fisher
 
2006 - Basta!: Web 2.0 mit asp.net 2.0
Daniel Fisher
 
2010 - Basta!: REST mit WCF 4, Silverlight und AJAX
Daniel Fisher
 
CONTRACT ENGINEERING SERVICES
ceseng
 

Similar to 2015 JavaScript introduction (20)

KEY
Managing and Using Assets in Rich Flash Experiences
David Ortinau
 
PDF
Nodejs - A quick tour (v5)
Felix Geisendörfer
 
PPTX
Enterprise JavaScript ... what the heck?
Nedelcho Delchev
 
PDF
bcgr3-jquery
tutorialsruby
 
PDF
bcgr3-jquery
tutorialsruby
 
PPT
PHP MySQL Workshop - facehook
Shashank Skills Academy
 
PDF
Nodejs - A quick tour (v4)
Felix Geisendörfer
 
PDF
Getting Started with Cross-Platform Mobile Development with Flutter and Dart
Harshith Keni
 
PDF
Web2.0 with jQuery in English
Lau Bech Lauritzen
 
PDF
0 uprise u_coding major overview 20210105
John Picasso
 
KEY
Txjs
Brian LeRoux
 
PPTX
Week01 jan19 introductionto_php
Jeanho Chu
 
PPTX
Be faster then rabbits
Vladislav Bauer
 
PDF
F8 tech talk_pinterest_v4
malorie_pinterest
 
PDF
Real-world polyglot programming on the JVM - Ben Summers (ONEIS)
jaxLondonConference
 
KEY
Palm Developer Day PhoneGap
Brian LeRoux
 
PPTX
"Python web development combines the simplicity of the language with powerful...
softwaretrainer2elys
 
PDF
Resume_Haifeng
Haifeng Huang
 
PPTX
Introduction to C# - Week 0
Jamshid Hashimi
 
PDF
Ayudando a los Viajeros usando 500 millones de Reseñas Hoteleras al Mes
Big Data Colombia
 
Managing and Using Assets in Rich Flash Experiences
David Ortinau
 
Nodejs - A quick tour (v5)
Felix Geisendörfer
 
Enterprise JavaScript ... what the heck?
Nedelcho Delchev
 
bcgr3-jquery
tutorialsruby
 
bcgr3-jquery
tutorialsruby
 
PHP MySQL Workshop - facehook
Shashank Skills Academy
 
Nodejs - A quick tour (v4)
Felix Geisendörfer
 
Getting Started with Cross-Platform Mobile Development with Flutter and Dart
Harshith Keni
 
Web2.0 with jQuery in English
Lau Bech Lauritzen
 
0 uprise u_coding major overview 20210105
John Picasso
 
Week01 jan19 introductionto_php
Jeanho Chu
 
Be faster then rabbits
Vladislav Bauer
 
F8 tech talk_pinterest_v4
malorie_pinterest
 
Real-world polyglot programming on the JVM - Ben Summers (ONEIS)
jaxLondonConference
 
Palm Developer Day PhoneGap
Brian LeRoux
 
"Python web development combines the simplicity of the language with powerful...
softwaretrainer2elys
 
Resume_Haifeng
Haifeng Huang
 
Introduction to C# - Week 0
Jamshid Hashimi
 
Ayudando a los Viajeros usando 500 millones de Reseñas Hoteleras al Mes
Big Data Colombia
 
Ad

More from Daniel Fisher (20)

PPTX
MD DevdDays 2016: Defensive programming, resilience patterns & antifragility
Daniel Fisher
 
PPTX
NRWConf, DE: Defensive programming, resilience patterns & antifragility
Daniel Fisher
 
PPTX
.NET Developer Days 2015, PL: Defensive programming, resilience patterns & an...
Daniel Fisher
 
PPTX
2015 - Basta! 2015, DE: JavaScript und build
Daniel Fisher
 
PPTX
2015 - Basta! 2015, DE: Defensive programming, resilience patterns & antifrag...
Daniel Fisher
 
PDF
2015 - Network 2015, UA: Defensive programming, resilience patterns & antifra...
Daniel Fisher
 
PPTX
2011 - Dotnet Information Day: NUGET
Daniel Fisher
 
PPTX
2011 - DNC: REST Wars
Daniel Fisher
 
PPTX
2010 - Basta!: IPhone Apps mit C#
Daniel Fisher
 
PPTX
2010 - Basta: ASP.NET Controls für Web Forms und MVC
Daniel Fisher
 
PPTX
2010 Basta!: Massendaten mit ADO.NET
Daniel Fisher
 
PPTX
2010 - Basta!: REST mit ASP.NET MVC
Daniel Fisher
 
PPTX
2009 - Microsoft Springbreak: IIS, PHP & WCF
Daniel Fisher
 
PPTX
2009 - NRW Conf: (ASP).NET Membership
Daniel Fisher
 
PPTX
2009 Dotnet Information Day: More effective c#
Daniel Fisher
 
PPTX
2009 - DNC: Silverlight ohne UI - Nur als Cache
Daniel Fisher
 
PPTX
2009 - Basta!: Url rewriting mit iis, asp.net und routing engine
Daniel Fisher
 
PPTX
2009 - Basta!: Agiles requirements engineering
Daniel Fisher
 
PPTX
2008 - TechDays PT: Modeling and Composition for Software today and tomorrow
Daniel Fisher
 
PPTX
2008 - TechDays PT: Building Software + Services with Volta
Daniel Fisher
 
MD DevdDays 2016: Defensive programming, resilience patterns & antifragility
Daniel Fisher
 
NRWConf, DE: Defensive programming, resilience patterns & antifragility
Daniel Fisher
 
.NET Developer Days 2015, PL: Defensive programming, resilience patterns & an...
Daniel Fisher
 
2015 - Basta! 2015, DE: JavaScript und build
Daniel Fisher
 
2015 - Basta! 2015, DE: Defensive programming, resilience patterns & antifrag...
Daniel Fisher
 
2015 - Network 2015, UA: Defensive programming, resilience patterns & antifra...
Daniel Fisher
 
2011 - Dotnet Information Day: NUGET
Daniel Fisher
 
2011 - DNC: REST Wars
Daniel Fisher
 
2010 - Basta!: IPhone Apps mit C#
Daniel Fisher
 
2010 - Basta: ASP.NET Controls für Web Forms und MVC
Daniel Fisher
 
2010 Basta!: Massendaten mit ADO.NET
Daniel Fisher
 
2010 - Basta!: REST mit ASP.NET MVC
Daniel Fisher
 
2009 - Microsoft Springbreak: IIS, PHP & WCF
Daniel Fisher
 
2009 - NRW Conf: (ASP).NET Membership
Daniel Fisher
 
2009 Dotnet Information Day: More effective c#
Daniel Fisher
 
2009 - DNC: Silverlight ohne UI - Nur als Cache
Daniel Fisher
 
2009 - Basta!: Url rewriting mit iis, asp.net und routing engine
Daniel Fisher
 
2009 - Basta!: Agiles requirements engineering
Daniel Fisher
 
2008 - TechDays PT: Modeling and Composition for Software today and tomorrow
Daniel Fisher
 
2008 - TechDays PT: Building Software + Services with Volta
Daniel Fisher
 
Ad

Recently uploaded (20)

PDF
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
PDF
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PDF
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
PDF
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
PPTX
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
PPTX
Practical Applications of AI in Local Government
OnBoard
 
PDF
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
PPTX
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
PDF
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
PDF
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
PDF
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
PDF
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
PDF
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
PDF
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
PDF
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PDF
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
PPTX
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
How to Comply With Saudi Arabia’s National Cybersecurity Regulations.pdf
Bluechip Advanced Technologies
 
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
Mastering Authorization: Integrating Authentication and Authorization Data in...
Hitachi, Ltd. OSS Solution Center.
 
Practical Applications of AI in Local Government
OnBoard
 
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
Kubernetes - Architecture & Components.pdf
geethak285
 
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 

2015 JavaScript introduction