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)

PPT
JavaScript Misunderstood
Bhavya Siddappa
 
PPTX
WT Module-3.pptx
RamyaH11
 
PPS
Advisor Jumpstart: JavaScript
dominion
 
PPT
Introduction to Javascript
Amit Tyagi
 
PPTX
Javascript
Mozxai
 
PDF
Javascript The Definitive Guideactivate Your Web Pages 6th Ed Flanagan
reknesluima
 
PPT
jQuery with javascript training by Technnovation Labs
Prasad Shende
 
PPT
Reversing JavaScript
Roberto Suggi Liverani
 
PPTX
JavaScripts & jQuery
Asanka Indrajith
 
PDF
Hsc IT Chap 3. Advanced javascript-1.pdf
AAFREEN SHAIKH
 
PPTX
JavaScript as Development Platform
Alexei Skachykhin
 
PPTX
Java Script basics and DOM
Sukrit Gupta
 
PPTX
Javascript Today
Sistek Yazılım
 
PPTX
JAVASRIPT and PHP Basics# Unit 2 Webdesign
NitinShelake4
 
PPTX
Java script
Sukrit Gupta
 
PPTX
Journey To The Front End World - Part3 - The Machine
Irfan Maulana
 
PPT
JavaScript - An Introduction
Manvendra Singh
 
PPTX
A walkthrough of JavaScript ES6 features
Michal Juhas
 
PDF
WEB MODULE 3.pdf
Deepika A B
 
JavaScript Misunderstood
Bhavya Siddappa
 
WT Module-3.pptx
RamyaH11
 
Advisor Jumpstart: JavaScript
dominion
 
Introduction to Javascript
Amit Tyagi
 
Javascript
Mozxai
 
Javascript The Definitive Guideactivate Your Web Pages 6th Ed Flanagan
reknesluima
 
jQuery with javascript training by Technnovation Labs
Prasad Shende
 
Reversing JavaScript
Roberto Suggi Liverani
 
JavaScripts & jQuery
Asanka Indrajith
 
Hsc IT Chap 3. Advanced javascript-1.pdf
AAFREEN SHAIKH
 
JavaScript as Development Platform
Alexei Skachykhin
 
Java Script basics and DOM
Sukrit Gupta
 
Javascript Today
Sistek Yazılım
 
JAVASRIPT and PHP Basics# Unit 2 Webdesign
NitinShelake4
 
Java script
Sukrit Gupta
 
Journey To The Front End World - Part3 - The Machine
Irfan Maulana
 
JavaScript - An Introduction
Manvendra Singh
 
A walkthrough of JavaScript ES6 features
Michal Juhas
 
WEB MODULE 3.pdf
Deepika A B
 
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
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 

2015 JavaScript introduction