The bestselling JavaScript guide, updated with current features
and best practices

Beginning JavaScript 5th Edition shows you how to
work effectively with JavaScript frameworks, functions, and modern
browsers, and teaches more effective coding practices using HTML5.
This new edition has been extensively updated to reflect the way
JavaScript is most commonly used today, introducing you to the
latest tools and techniques available to JavaScript developers.
Coverage includes modern coding practices using HTML5 markup, the
JSON data format, DOM APIs, the jQuery framework, and more.
Exercises with solutions provide plenty of opportunity to practice,
and the companion website offers downloadable code for all examples
given in the book.

* Learn JavaScript using the most up to date coding style

* Understand JSON, functions, events, and feature detection

* Utilize the new HTML5 elements and the related API

* Explore new features including geolocation, local storage, and
more

JavaScript has shaped the Web from a passive medium into one
that is rich, dynamic, and interactive. No matter the technology on
the server side, it's JavaScript that makes it come alive in the
browser. To learn JavaScript the way it's used today, Beginning
JavaScript, 5th Edition is your concise guide.



Autorentext

About the authors

Jeremy McPeak is a professional programmer and analyst who works extensively with JavaScript and C#. He coauthored both of the previous editions of Beginning JavaScript, and authored the well-reviewed JavaScript 24-Hour Trainer. He contributes to the online, web-centric learning site Tuts+ Code, covering topics such as JavaScript, C#, and the .NET Framework.

Paul Wilton owns his own company, providing online booking systems to vacation property owners, which is largely developed using JavaScript.

Zusammenfassung
The bestselling JavaScript guide, updated with current features and best practices

Beginning JavaScript 5th Edition shows you how to work effectively with JavaScript frameworks, functions, and modern browsers, and teaches more effective coding practices using HTML5. This new edition has been extensively updated to reflect the way JavaScript is most commonly used today, introducing you to the latest tools and techniques available to JavaScript developers. Coverage includes modern coding practices using HTML5 markup, the JSON data format, DOM APIs, the jQuery framework, and more. Exercises with solutions provide plenty of opportunity to practice, and the companion website offers downloadable code for all examples given in the book.

  • Learn JavaScript using the most up to date coding style
  • Understand JSON, functions, events, and feature detection
  • Utilize the new HTML5 elements and the related API
  • Explore new features including geolocation, local storage, and more

JavaScript has shaped the Web from a passive medium into one that is rich, dynamic, and interactive. No matter the technology on the server side, it's JavaScript that makes it come alive in the browser. To learn JavaScript the way it's used today, Beginning JavaScript, 5th Edition is your concise guide.



Inhalt

Introduction xix

Chapter 1: Introduction to Javascript and the Web 1

Introduction to JavaScript 1

What is JavaScript? 2

JavaScript and the Web 3

What Can JavaScript Do for Me? 4

Tools Needed to Create JavaScript Web Applications 4

Development Tools 4

Web Browsers 5

Where Do My Scripts Go? 7

Linking to an External JavaScript File 7

Advantages of Using an External File 8

Your First Simple JavaScript Program 9

Writing More JavaScript 10

A Brief Look at Browsers and Compatibility Problems 15

Summary 16

Chapter 2: Data Types and Variables 17

Types of Data in JavaScript 18

Numerical Data 18

Text Data 19

Boolean Data 20

VariablesStoring Data in Memory 20

Creating Variables and Giving Them Values 22

Assigning Variables with the Value of Other Variables 24

Using DataCalculations and Basic String Manipulation 26

Numerical Calculations 26

Increment and Decrement Operators 29

Operator Precedence 30

Basic String Operations 35

Mixing Numbers and Strings 37

Data Type Conversion 38

Dealing with Strings That Won't Convert 41

Arrays 43

A MultiDimensional Array 47

Summary 52

Chapter 3: Decisions and Loops 55

Decision MakingThe if and switch Statements 56

Comparison Operators 56

Precedence 57

Assignment versus Comparison 57

Assigning the Results of Comparisons 58

The if Statement 58

Logical Operators 62

AND 63

OR 64

NOT 64

Multiple Conditions Inside an if Statement 65

else and else if 69

Comparing Strings 70

The switch Statement 71

Executing the Same Code for Different Cases 75

LoopingThe for and while Statements 76

The for Loop 76

The forin Loop 80

The while Loop 80

The dowhile loop 82

The break and continue Statements 83

Summary 84

Chapter 4: Functions and Scope 87

Creating Your Own Functions 88

Scope and Lifetime 92

Global Scope 92

Functional Scope 93

Identifier Lookup 93

Functions as Values 94

Summary 97

Chapter 5: JavascriptAn ObjectBased Language 99

ObjectBased Programming 100

What are Objects? 100

Objects in JavaScript 100

Using JavaScript Objects 101

Creating an Object 102

Using an Object's Properties 103

Calling an Object's Methods 104

Primitives and Objects 104

JavaScript's Native Object Types 105

String Objects 105

The length Property 106

Finding a String Inside Another StringThe indexOf()

and lastIndexOf() Methods 106

Copying Part of a StringThe substr() and substring() Methods 109

Converting CaseThe toLowerCase() and toUpperCase() Methods 110

Selecting a Single Character from a StringThe charAt() and charCodeAt() Methods 111

Converting Character Codes to a StringThe fromCharCode() Method 115

Removing Leading and Trailing WhitespaceThe trim() Method 115

Array Objects 116

Finding Out How Many Elements are in an ArrayThe length Property 116

Adding ElementsThe push() Method 117

Joining ArraysThe concat() Method 117

Copying Part of an ArrayThe slice() Method 118

Converting an Array into a Single StringThe join() Method 119

Putting Your Array in OrderThe sort() Method 119

Putting Your Array into Reverse OrderThe reverse() Method 121

Finding Array ElementsThe indexOf() and lastIndexOf() Methods 122

Iterating through an Array without Loops 12...

Titel
Beginning JavaScript
EAN
9781118903438
ISBN
978-1-118-90343-8
Format
E-Book (pdf)
Hersteller
Herausgeber
Veröffentlichung
17.02.2015
Digitaler Kopierschutz
Adobe-DRM
Dateigrösse
36.03 MB
Anzahl Seiten
768
Jahr
2015
Untertitel
Englisch
Auflage
5. Aufl.