SlideShare uma empresa Scribd logo
1 de 12
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

3.1 javascript objects_DOM
3.1 javascript objects_DOM3.1 javascript objects_DOM
3.1 javascript objects_DOMJalpesh Vasa
 
javascript objects
javascript objectsjavascript objects
javascript objectsVijay Kalyan
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - ObjectsWebStackAcademy
 
Ajax and JavaScript Bootcamp
Ajax and JavaScript BootcampAjax and JavaScript Bootcamp
Ajax and JavaScript BootcampAndreCharland
 
Basic JavaScript Tutorial
Basic JavaScript TutorialBasic JavaScript Tutorial
Basic JavaScript TutorialDHTMLExtreme
 
JavaScript in Object-Oriented Way
JavaScript in Object-Oriented WayJavaScript in Object-Oriented Way
JavaScript in Object-Oriented WayChamnap Chhorn
 
JavaScript - Chapter 6 - Basic Functions
 JavaScript - Chapter 6 - Basic Functions JavaScript - Chapter 6 - Basic Functions
JavaScript - Chapter 6 - Basic FunctionsWebStackAcademy
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and StatementsWebStackAcademy
 
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...Edureka!
 
8 introduction to_java_script
8 introduction to_java_script8 introduction to_java_script
8 introduction to_java_scriptVijay Kalyan
 

Mais procurados (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
 

Semelhante a JavaScript Guide

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)jaxLondonConference
 
Introduction to Scala JS
Introduction to Scala JSIntroduction to Scala JS
Introduction to Scala JSKnoldus Inc.
 
WT Unit-3 PPT.pptx
WT Unit-3 PPT.pptxWT Unit-3 PPT.pptx
WT Unit-3 PPT.pptxTusharTikia
 
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 Beginnerscalltutors
 
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)Nuzhat Memon
 
Sugar Presentation - YULHackers March 2009
Sugar Presentation - YULHackers March 2009Sugar Presentation - YULHackers March 2009
Sugar Presentation - YULHackers March 2009spierre
 
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 WebsiteJames Long
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScriptAndres Baravalle
 
java handout.doc
java handout.docjava handout.doc
java handout.docSOMOSCO1
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponLaurent Duveau
 
Typescript in 30mins
Typescript in 30mins Typescript in 30mins
Typescript in 30mins Udaya Kumar
 
Scala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologistScala and jvm_languages_praveen_technologist
Scala and jvm_languages_praveen_technologistpmanvi
 

Semelhante a JavaScript Guide (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
 

Último

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
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 ConsultingTechSoup
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 

Último (20)

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
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
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 

JavaScript Guide

  • 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