SlideShare une entreprise Scribd logo
1  sur  12
Télécharger pour lire hors ligne
JavaScript Journey
wanqiang.ji@gmail.com
Nov 26, 2013
What?
•

a computer programming language
concurrent,class-based,object-oriented

JavaScript vs Java(Programming language)
!

•

JavaScript vs Java(Software Platform)

A set of serval computer software products and specifications
from Sun Microsystems.
!

!

•

JavaScript vs Javanese Language

Provide a system for developing application software and
deploying it a cross-platform computing environment.

Javanese People,Java island
!

75,500,000 people used it(more than 30% of total population in Indonesia)

QA:What is JavaScript?
JavaScript (JS) is an interpreted computer programming language.
Brief
•

Why?

Batting = Microsoft vs Netscape
Brendan Eich -> LiveScript
Sun Oracle

!

•

How?

prototype-based scripting language,dynamic typing,interpreted,weak typing
Core:ECMAScript,DOM(Document Object Model),BOM(Browser Object Model)

!

•

When?
!

•

Whose?

client-side:jQuery
server-side:node.js
desktop:CommonJS
game:cocos2d-x
Sun -> Oracle
Syntax
Brendan Eich summarized the ancestry of the syntax in the first paragraph of the JavaScript 1.1 specification[1] as follows:
JavaScript borrows most of its syntax from Java, but also inherits from Awk and Perl,
with some indirect influence from Self in its object prototype system.

•

Basics

•

Objects

•

Variable

•

Exception handling

•

Primitive data types

•

Native Functions and Methods

•

Native objects

•

DOM

•

Operators

•

BOM

•

Control Structures

•

Libraries

•

Functions

•

References
Basics
•

Case sensitivity
!

!

•

It is common to start the name of a constructor with a capitalised letter, and the name of a function or
variable with a lower-case letter.

Spaces, tabs and newlines used outside of string constants are called whitespace.
Unlike C, whitespace in JavaScript source can directly impact semantics.
Because of a technique called "automatic semicolon insertion" (ASI), some statements that are well formed when a newline is
parsed will be considered complete (as if a semicolon were inserted just prior to the newline).

Whitespace and semicolons
!

!

!

•

Comments

Comment syntax is the same as in C++ and many other languages.
Variable
Variables in standard JavaScript have no type attached, and any value can be stored in any variable. Variables are declared with
a var statement, multiple variables can be declared at once.
Name Ruler:An identifier must start with a letter, underscore (_), or dollar sign ($); subsequent characters can also be digits (0-9).
Because JavaScript is case sensitive, letters include the characters "A" through "Z" (uppercase) and the characters "a" through "z"
(lowercase).

Note that JavaScript's strict mode forbids the assignment of an undeclared variable, which avoids global namespace pollution.
Primitive data types
•

Undefined

The value of "undefined" is assigned to all uninitialized variables, and is also returned when checking for object properties that do not exist.

!

•

Null

Unlike undefined, null is often set to indicate that something has been declared but has been defined to be empty.

!

•

Number

Numbers are represented in binary as IEEE-754 Doubles, which provides an accuracy nearly 16 significant digits. Because they are floating point
numbers, they do not always exactly represent real numbers, including fractions.

!

•

String

A string in JavaScript is a sequence of characters. In JavaScript, strings can be created directly by placing the series of characters between
double or single quotes.

!

•

Alerts

Alerts are a common Javascript feature.

!

•

Boolean

JavaScript provides a Boolean data type
with true and false literals.
Native Objects
•

Array
!

•

Date
!

•

Error
!

•

Math
!

•

Regular Expression
!

•

Function
Operators
•

Arithmetic

•

Assignment

•

Destructuring assignment

•

Comparison

•

Logical

•

Bitwise

•

String
Control Structures
•

if … else …

•

Switch … case …

•

for Loop

•

for … in loop

•

While loop

•

Do … while loop

•

With

•

Labels
Functions
Reference
•

http://en.wikipedia.org/wiki/JavaScript#Server-side_JavaScript

•

http://en.wikipedia.org/wiki/Java_(programming_language)

•

http://en.wikipedia.org/wiki/Java_(software_platform)

•

http://en.wikipedia.org/wiki/Javanese_script

•

http://www.w3schools.com/js/default.asp

•

http://en.wikipedia.org/wiki/JavaScript_syntax

Contenu connexe

Tendances

JavaScript in Object-Oriented Way
JavaScript in Object-Oriented WayJavaScript in Object-Oriented Way
JavaScript in Object-Oriented Way
Chamnap Chhorn
 

Tendances (20)

Javascript functions
Javascript functionsJavascript functions
Javascript functions
 
3.1 javascript objects_DOM
3.1 javascript objects_DOM3.1 javascript objects_DOM
3.1 javascript objects_DOM
 
Java script
Java scriptJava script
Java script
 
Javascript
JavascriptJavascript
Javascript
 
Introduction to JavaScript Basics.
Introduction to JavaScript Basics.Introduction to JavaScript Basics.
Introduction to JavaScript Basics.
 
Javascript
JavascriptJavascript
Javascript
 
javascript objects
javascript objectsjavascript objects
javascript objects
 
3. Java Script
3. Java Script3. Java Script
3. Java Script
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
 
Java script basics
Java script basicsJava script basics
Java script basics
 
Ajax and JavaScript Bootcamp
Ajax and JavaScript BootcampAjax and JavaScript Bootcamp
Ajax and JavaScript Bootcamp
 
Basic JavaScript Tutorial
Basic JavaScript TutorialBasic JavaScript Tutorial
Basic JavaScript Tutorial
 
JavaScript in Object-Oriented Way
JavaScript in Object-Oriented WayJavaScript in Object-Oriented Way
JavaScript in Object-Oriented Way
 
Lecture 5 javascript
Lecture 5 javascriptLecture 5 javascript
Lecture 5 javascript
 
JavaScript - Chapter 6 - Basic Functions
 JavaScript - Chapter 6 - Basic Functions JavaScript - Chapter 6 - Basic Functions
JavaScript - Chapter 6 - Basic Functions
 
Java script
Java scriptJava script
Java script
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
 
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
 
8 introduction to_java_script
8 introduction to_java_script8 introduction to_java_script
8 introduction to_java_script
 
JavaScript Data Types
JavaScript Data TypesJavaScript Data Types
JavaScript Data Types
 

Similaire à Javascript Journey

Similaire à Javascript Journey (20)

Real-world polyglot programming on the JVM - Ben Summers (ONEIS)
Real-world polyglot programming on the JVM  - Ben Summers (ONEIS)Real-world polyglot programming on the JVM  - Ben Summers (ONEIS)
Real-world polyglot programming on the JVM - Ben Summers (ONEIS)
 
Introduction to Scala JS
Introduction to Scala JSIntroduction to Scala JS
Introduction to Scala JS
 
WT Unit-3 PPT.pptx
WT Unit-3 PPT.pptxWT Unit-3 PPT.pptx
WT Unit-3 PPT.pptx
 
Step by Step Guide on Essay Format in APA For Beginners
Step by Step Guide on Essay Format in APA For BeginnersStep by Step Guide on Essay Format in APA For Beginners
Step by Step Guide on Essay Format in APA For Beginners
 
Java Fx
Java FxJava Fx
Java Fx
 
Std 12 Computer Chapter 7 Java Basics (Part 1)
Std 12 Computer Chapter 7 Java Basics (Part 1)Std 12 Computer Chapter 7 Java Basics (Part 1)
Std 12 Computer Chapter 7 Java Basics (Part 1)
 
Lecture7
Lecture7Lecture7
Lecture7
 
Unit 1
Unit 1Unit 1
Unit 1
 
Js slideshare
Js   slideshareJs   slideshare
Js slideshare
 
js.pptx
js.pptxjs.pptx
js.pptx
 
Sugar Presentation - YULHackers March 2009
Sugar Presentation - YULHackers March 2009Sugar Presentation - YULHackers March 2009
Sugar Presentation - YULHackers March 2009
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Incremental Development with Lisp: Building a Game and a Website
Incremental Development with Lisp: Building a Game and a WebsiteIncremental Development with Lisp: Building a Game and a Website
Incremental Development with Lisp: Building a Game and a Website
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
JavaScript Tut (1).pptx
JavaScript Tut (1).pptxJavaScript Tut (1).pptx
JavaScript Tut (1).pptx
 
JavaScript Tut (1).pptx
JavaScript Tut (1).pptxJavaScript Tut (1).pptx
JavaScript Tut (1).pptx
 
java handout.doc
java handout.docjava handout.doc
java handout.doc
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret Weapon
 
Typescript in 30mins
Typescript in 30mins Typescript in 30mins
Typescript in 30mins
 
Scala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologistScala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologist
 

Dernier

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Dernier (20)

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 

Javascript Journey

  • 2. What? • a computer programming language concurrent,class-based,object-oriented JavaScript vs Java(Programming language) ! • JavaScript vs Java(Software Platform) A set of serval computer software products and specifications from Sun Microsystems. ! ! • JavaScript vs Javanese Language Provide a system for developing application software and deploying it a cross-platform computing environment. Javanese People,Java island ! 75,500,000 people used it(more than 30% of total population in Indonesia) QA:What is JavaScript? JavaScript (JS) is an interpreted computer programming language.
  • 3. Brief • Why? Batting = Microsoft vs Netscape Brendan Eich -> LiveScript Sun Oracle ! • How? prototype-based scripting language,dynamic typing,interpreted,weak typing Core:ECMAScript,DOM(Document Object Model),BOM(Browser Object Model) ! • When? ! • Whose? client-side:jQuery server-side:node.js desktop:CommonJS game:cocos2d-x Sun -> Oracle
  • 4. Syntax Brendan Eich summarized the ancestry of the syntax in the first paragraph of the JavaScript 1.1 specification[1] as follows: JavaScript borrows most of its syntax from Java, but also inherits from Awk and Perl, with some indirect influence from Self in its object prototype system. • Basics • Objects • Variable • Exception handling • Primitive data types • Native Functions and Methods • Native objects • DOM • Operators • BOM • Control Structures • Libraries • Functions • References
  • 5. Basics • Case sensitivity ! ! • It is common to start the name of a constructor with a capitalised letter, and the name of a function or variable with a lower-case letter. Spaces, tabs and newlines used outside of string constants are called whitespace. Unlike C, whitespace in JavaScript source can directly impact semantics. Because of a technique called "automatic semicolon insertion" (ASI), some statements that are well formed when a newline is parsed will be considered complete (as if a semicolon were inserted just prior to the newline). Whitespace and semicolons ! ! ! • Comments Comment syntax is the same as in C++ and many other languages.
  • 6. Variable Variables in standard JavaScript have no type attached, and any value can be stored in any variable. Variables are declared with a var statement, multiple variables can be declared at once. Name Ruler:An identifier must start with a letter, underscore (_), or dollar sign ($); subsequent characters can also be digits (0-9). Because JavaScript is case sensitive, letters include the characters "A" through "Z" (uppercase) and the characters "a" through "z" (lowercase). Note that JavaScript's strict mode forbids the assignment of an undeclared variable, which avoids global namespace pollution.
  • 7. Primitive data types • Undefined The value of "undefined" is assigned to all uninitialized variables, and is also returned when checking for object properties that do not exist. ! • Null Unlike undefined, null is often set to indicate that something has been declared but has been defined to be empty. ! • Number Numbers are represented in binary as IEEE-754 Doubles, which provides an accuracy nearly 16 significant digits. Because they are floating point numbers, they do not always exactly represent real numbers, including fractions. ! • String A string in JavaScript is a sequence of characters. In JavaScript, strings can be created directly by placing the series of characters between double or single quotes. ! • Alerts Alerts are a common Javascript feature. ! • Boolean JavaScript provides a Boolean data type with true and false literals.
  • 10. Control Structures • if … else … • Switch … case … • for Loop • for … in loop • While loop • Do … while loop • With • Labels