SlideShare a Scribd company logo
JavaScript
Module I
by
Mustafa Qamar-ud-Din
m.qamaruddin@outlook.com
Agenda

Why JavaScript?

Data Types

Flow Control Structures

Functions
− Nested Functions
− Recursion
− Closures

Error Handling

Objects
− Built-in Objects
− User-defined Objects

Document Object Model
− DOM Level 1
− DOM Level 2
− DOM Level 3

Interview Questions

Recommended Readings

What’s Next?

Hands On
Why JavaScript?
"JavaScript is
the only
language that
I’m aware of
that people feel
they don’t need
to learn before
they start using
it."
- Douglas Crockford
Why JavaScript?

Web Development
− Client-Side
− Server-Side

Mobile Applications

Windows 8
Applications

Chrome Extensions

VR

Games & Graphics

Desktop Applications
(Elektron)
Data Types

Statements

Expressions

Variables
− Hoisting

Constants
− Immutable
Identifiers
− Mutable Values

Operators
− Assignment
− Increment,

Weakly Typed
− Type Coercion
− Dynamic Typing

Primitive Types
− Booleans
− Numbers
− Strings
− Null
− Undefined
− NaN
− Symbols (ES6)
Flow Control Structures

if

if / else

if / else if / else

while

do while

for

switch

continue

break
Functions (First-class_function)

Nested Functions

Recursion

Closures

Self Invoking Functions
Nested Functions
Create a function sum
that will work like
that:
sum(a)(b) = a+b.
Yes, the syntax is
dual brackets. Funny,
isn’t it? For
instance:
sum(1)(2) = 3
Sum(5)(-1) = 4
Nested Functions
Create a function sum
that will work like
that:
sum(a)(b) = a+b and
accepts any number of
brackets.
For instance:
sum(1)(2) == 3
sum(5)(-1)(2) == 6
sum(6)(-1)(-2)(-3) ==
0
Sum(0)(1)(2)(3)(4)(5)
Closures
Here is a function to create an army of shooters:
function makeArmy() {
var shooters = []
for(var i=0; i<10; i++) {
var shooter = function() { // a shooter is a function
alert(i) // which should alert it's number
}
shooters.push(shooter)
}
return shooters
}
var army = makeArmy()
Error Handling

try catch finally

window.onerror
Objects

Built-in Objects

User-defined Objects
− Function
− JSON
− Associative Array

Pass by Value & Reference

Prototype Chain
Built-in Objects

Number

String
− getIndexOf
− getLastIndexOf
− search

RegEx
− match
− exec
− test

Date
− getTime / setTime
Objects

Built-in Objects

User-defined Objects
− Function
− JSON
− Associative Array

Pass by Value & Reference

Prototype Chain
Objects

Methods
− is
− hasOwnProperty
− isPrototypeOf
− toString
− toSource
− valueOf
− apply
− bind
− Call

Operators

More Related Content

Similar to Java Script - Module I (20)

PPSX
Javascript variables and datatypes
Varun C M
 
PDF
slides-students-C03.pdf
HARDIKGUPTAMCO21373
 
PDF
JavaScript - Chapter 4 - Types and Statements
WebStackAcademy
 
PDF
JavaScript Interview Questions and Answers | Full Stack Web Development Train...
Edureka!
 
PPS
CS101- Introduction to Computing- Lecture 23
Bilal Ahmed
 
PPTX
LinkedIn TBC JavaScript 100: Intro
Adam Crabtree
 
PPT
Intermediate JavaScript
☆ Milan Adamovsky ☆
 
PPT
JavaScript Tutorial
Bui Kiet
 
PDF
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
AlexShon3
 
PDF
JavaScript Basics and Best Practices - CC FE & UX
JWORKS powered by Ordina
 
PPT
JavaScript - An Introduction
Manvendra Singh
 
PPTX
Paca java script slid
pacatarpit
 
PPT
13665449.ppt
JP Chicano
 
PPTX
Class[2][29th may] [javascript]
Saajid Akram
 
PDF
Client sidescripting javascript
Selvin Josy Bai Somu
 
PDF
03 Advanced JavaScript
Ynon Perek
 
PPTX
Unit - 4 all script are here Javascript.pptx
kushwahanitesh592
 
PPT
JavaScript - Programming Languages course
yoavrubin
 
PPTX
Introduction to JavaScript
SadhanaParameswaran
 
PDF
Grant Rogerson SDEC2015
Grant Rogerson
 
Javascript variables and datatypes
Varun C M
 
slides-students-C03.pdf
HARDIKGUPTAMCO21373
 
JavaScript - Chapter 4 - Types and Statements
WebStackAcademy
 
JavaScript Interview Questions and Answers | Full Stack Web Development Train...
Edureka!
 
CS101- Introduction to Computing- Lecture 23
Bilal Ahmed
 
LinkedIn TBC JavaScript 100: Intro
Adam Crabtree
 
Intermediate JavaScript
☆ Milan Adamovsky ☆
 
JavaScript Tutorial
Bui Kiet
 
javascript-variablesanddatatypes-130218094831-phpapp01.pdf
AlexShon3
 
JavaScript Basics and Best Practices - CC FE & UX
JWORKS powered by Ordina
 
JavaScript - An Introduction
Manvendra Singh
 
Paca java script slid
pacatarpit
 
13665449.ppt
JP Chicano
 
Class[2][29th may] [javascript]
Saajid Akram
 
Client sidescripting javascript
Selvin Josy Bai Somu
 
03 Advanced JavaScript
Ynon Perek
 
Unit - 4 all script are here Javascript.pptx
kushwahanitesh592
 
JavaScript - Programming Languages course
yoavrubin
 
Introduction to JavaScript
SadhanaParameswaran
 
Grant Rogerson SDEC2015
Grant Rogerson
 

Recently uploaded (20)

PDF
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
PDF
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
PDF
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
PDF
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
PDF
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
PDF
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
PPTX
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
PDF
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
PDF
Open Source Milvus Vector Database v 2.6
Zilliz
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
PDF
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
PDF
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
PDF
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
PDF
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PDF
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
PPTX
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
 
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
Open Source Milvus Vector Database v 2.6
Zilliz
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Why aren't you using FME Flow's CPU Time?
Safe Software
 
Ad

Java Script - Module I