SlideShare ist ein Scribd-Unternehmen logo
1 von 12
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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

Was ist angesagt? (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
 

Ähnlich wie Javascript Journey

Ähnlich wie 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
 

Kürzlich hochgeladen

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Kürzlich hochgeladen (20)

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
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
 
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
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
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.
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 

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