20,99 €
Have big dreams? Kick start them with JavaScript! If we've learned one thing from the Millennial generation, it's that no one is too young to make history online. JavaScript For Kids For Dummies introduces pre-teens and early teens alike to the world of JavaScript, which is an integral programming language that drives the functionality of websites and apps. This informative, yet engaging text guides you through the basics of coding with JavaScript, and is an essential resource if you want to expand your technology skills while following easy, step-by-step instructions. Through small, goal-oriented projects, you learn key coding concepts, while actually creating apps, games, and more. This hands-on experience, coupled with the presentation of ideas in a simple style, allows you to both learn and retain JavaScript fundamentals. JavaScript has been heralded as 'the programming language of the web,' and many kids are interested in learning how to use it; however, most schools don't offer coding classes at this level, and most families can't afford the high cost of coding classes through a summer camp. But this can't stop you from developing your JavaScript coding skills! This fun text is all you need to get started on your JavaScript journey. * Explore the basics of JavaScript through the creation of a calculator app * Deepen your understanding of HTML, arrays, and variables by building a grocery shopping app * Learn conditional logic through the development of a choose your own adventure game * Discover loops and strings by creating a lemonade stand app and MadLibs-style game JavaScript For Kids For Dummies brings pre-teens and early teens into the world of coding by teaching them one of the key Web design languages.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 306
Veröffentlichungsjahr: 2015
JavaScript® For Kids For Dummies®
Published by: John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030-5774, www.wiley.com
Copyright © 2015 by John Wiley & Sons, Inc., Hoboken, New Jersey
Published simultaneously in Canada
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.
Trademarks: Wiley, For Dummies, the Dummies Man logo, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc., and may not be used without written permission. JavaScript is a registered trademark of Oracle, Inc. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc., is not associated with any product or vendor mentioned in this book.
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: WHILE THE PUBLISHER AND AUTHOR HAVE USED THEIR BEST EFFORTS IN PREPARING THIS BOOK, THEY MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS BOOK AND SPECIFICALLY DISCLAIM ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES REPRESENTATIVES OR WRITTEN SALES MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR YOUR SITUATION. YOU SHOULD CONSULT WITH A PROFESSIONAL WHERE APPROPRIATE. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM.
For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. For technical support, please visit www.wiley.com/techsupport.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.
Library of Congress Control Number: 2015945282
ISBN 978-1-119-11986-9 (pbk); ISBN 978-1-119-11989-0 (ebk); ISBN 978-1-119-11988-3
Table of Contents
Cover
Introduction
About This Book
Foolish Assumptions
Icons Used In This Book
Beyond the Book
Where to Go from Here
Part I: What Is JavaScript? Alert! JavaScript Is Awesome!
Chapter 1: Programming the Web
What Is Programming?
Talking to Computers
Choosing a Language
What Is JavaScript?
Get Your Browser Ready
Opening the Web Developer Tools
Introducing the JavaScript Console
Running Your First JavaScript Commands
Having Fun with Math
Chapter 2: Understanding Syntax
Saying Precisely What You Mean
Making a Statement
Following the Rules
Chapter 3: Giving and Receiving Data
Mastering Variables
Understanding Data Types
Prompting the User for Input
Responding to Input
Combining Input and Output
Chapter 4: Fiddling with Web Applications
Introducing JSFiddle
Creating a JSFiddle Account
Sharing Your Fiddle
Saving Your App
Part II: Animating the Web
Chapter 5: JavaScript and HTML
Writing HTML
Knowing Your HTML Elements
Adding Attributes to Elements
Changing HTML with JavaScript
Chapter 6: JavaScript and CSS
Meet Douglas the JavaScript Robot
CSS Basics
CSS Properties Give You Style
Customize Your Own JavaScript Robot!
Chapter 7: Building an Animated Robot
Changing CSS with JavaScript
Make Douglas Dance!
Adding a second animation function
Part III: Getting Operations
Chapter 8: Building Your Dream Car with Operands
Knowing Your Operands
Working with Objects
Configuring Your Dream Car
Chapter 9: Putting It Together with Operators
Introducing the Super-Calculator
Super-Calculator Tricks
Chapter 10: Creating Your Own JavaScript Word Game
Creating a Variable Story
Creating the Word Replacement Game
Part IV: Arrays and Functions
Chapter 11: Creating and Changing Arrays
What Are Arrays?
Creating and Accessing Arrays
Changing Array Element Values
Working with Array Methods
Learning the Ways of Arrays
Chapter 12: Making It Functional
Understanding Functions
Knowing What Functions Are Made Of
Building Function Junction
Chapter 13: Creating a Wish List Program
Introducing the Wish List Program
Forking the Code
Writing the HTML
Writing the JavaScript Code
Part V: Freedom of Choice
Chapter 14: Making Decisions with the If…Else Statement
Boolean Logic
Introducing if…else Statements
Combining Comparisons with Logical Operators
Freshening Up the JavaScript Pizzeria
Chapter 15: Doing Different Things with Switch
Writing a Switch
Building the Activity-of-the-Day Calendar
Chapter 16: Choose Your Own Adventure
Planning the Story
Playing the Game
Forking the Code
Tiptoeing through the HTML and CSS
Writing the Martian Rescue! JavaScript
Part VI: Loops
Chapter 17: What’s This Loop For?
Introducing the for Loop
Random Weather Forecasting
Chapter 18: Using While Loops
Writing a while Loop
Coding the Lunch Game
Moving to Your Own Website
Chapter 19: Building a Lemonade Stand
Playing the Game
A Lesson in Business
Building the Game
Improving the Lemonade Game
About the Authors
Cheat Sheet
Advertisement Page
Connect with Dummies
End User License Agreement
Cover
Table of Contents
Begin Reading
i
ii
v
vi
vii
viii
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
371
372
373
374
375
376
JavaScript For Kids For Dummies is an introduction to the basics of JavaScript coding. In each chapter, we walk you step-by-step through creating JavaScript programs for the web. Designed for kids of all ages, with no coding experience, we strive to introduce this technical topic in a fun, engaging, and interactive way.
JavaScript is the most widely used programming language in the world today. That’s why we think you’ve made a great decision by beginning your journey into the world of coding by picking up this book.
JavaScript is fun and easy to learn! With some determination and imagination, you’ll be on your way to creating your very own JavaScript programs in no time!
Just as the only way to Carnegie Hall is to practice, practice, practice, the only way to become a better programmer is to code, code, code!
We seek to “de-code” the language of JavaScript for you and give you an understanding of the concepts. With the ability to move at your own pace, JavaScript For Kids For Dummies will get you up to speed. In this book, you learn how to create fun games and programs. We even show you how to customize and build your own versions of the games that you can post to the web and share with your friends!
Whether you know a little JavaScript or you’ve never seen it before, this book shows you how to write JavaScript the right way.
Topics covered in this book include the following:
The basic structures of JavaScript programs
JavaScript expressions and operators
Structuring your programs with functions
Writing loops
Working with JavaScript, HTML5, and CSS3
Making choices with
if…else
statements
Learning JavaScript isn’t only about learning how to write the language. It’s also about accessing the tools and the community that has been built around the language. JavaScript programmers have refined the tools and techniques used to write JavaScript over the language’s long and exciting history. Throughout this book, we mention important techniques and tools for testing, documenting, and writing better code!
To make this book easier to read, you’ll want to keep in mind a few tips. First, all JavaScript code and all HTML and CSS markup appears in monospaced type like this:
document.write("Hi!");
The margins on a book page don’t have the same room as your monitor likely does, so long lines of HTML, CSS, and JavaScript may break across multiple lines. Remember that your computer sees such lines as single lines of HTML, CSS, or JavaScript. We indicate that everything should be on one line by breaking it at a punctuation character or space and then indenting any overage, like so:
document.getElementById("thisIsAnElementInTheDocument").addEventListener("click",doSomething,false);
HTML and CSS don’t care very much about whether you use uppercase or lowercase letters or a combination of the two. But, JavaScript cares a lot! In order to make sure that you get the correct results from the code examples in the book, always stick to the same capitalizations that we use.
You don’t need to be a “programming ninja” or a “hacker” to understand programming. You don’t need to understand how the guts of your computer work. You don’t even need to know how to count in binary.
However, we do need to make a couple of assumptions about you. We assume that you can turn your computer on, that you know how to use a mouse and a keyboard, and that you have a working Internet connection and web browser. If you already know something about how to make web pages (it doesn’t take much!), you’ll have a jumpstart on the material.
The other things you need to know to write and run JavaScript code are details we cover in this book, and the one thing you’ll find to be true is that programming requires attention to details.
Here’s a list of the icons we use in this book to flag text and information that’s especially noteworthy.
This icon highlights technical details that you may or may not find interesting. Feel free to skip this information, but if you’re the techie type, you might enjoy reading it.
This icon highlights helpful tips that show you easy ways or shortcuts that will save you time or effort.
Whenever you see this icon, pay close attention. You won’t want to forget the information you’re about to read — or, in some cases, we’ll remind you about something that you’ve already learned that you may have forgotten.
Be careful. This icon warns you of pitfalls to avoid.
We’ve put together a lot of extra content that you won’t find in this book. Go online to find the following:
Cheat Sheet:
An online Cheat Sheet is available at
www.dummies.com/cheatsheet/javascriptforkids
. Here, you find information on converting CSS property names to JavaScript; a list of common web browser events that JavaScript can respond to; and a list of words that can’t be used as JavaScript variables, functions, methods, loop labels, or object names.
Web Extras:
Online articles covering additional topics are available at
www.dummies.com/extras/javascriptforkids
. In these articles, we cover things like HTML5 form input tricks, how to name JavaScript variables, JavaScript troubleshooting tips, and more.
Coding with JavaScript is fun, and when you get a little knowledge under your belt, the world of interactive web applications is your oyster! So buckle up! We hope you enjoy the book and our occasional pearls of wisdom.
If you want to show us changes and improvements you make to our games, or programs you come up with on your own, you can do so on Facebook (www.facebook.com/watzthisco), Twitter (www.twitter.com/watzthisco), or via email at [email protected]. We’re excited to see what you come up with!
Part I
In this part …
Programming the Web
Understanding Syntax
Giving and Receiving Data
Fiddling with Web Applications
For Dummies can help you get started with lots of subjects. Visit www.dummies.com to learn more and do more with For Dummies!
Chapter 1
JavaScript is a powerful language that’s easy to learn! In this chapter, we explain the basics of programming, tell you what JavaScript is, and get you started with writing your first JavaScript commands.
One of the most important parts of starting any new project is to make sure you have your workshop stocked with all the correct tools. In this chapter, you install and configure all the programs you need and start experimenting with some real JavaScript programs!
A computer program is a series of instructions that can be understood and followed by a computer. Computer programming, also known as coding, is what we call it when we write these instructions. Computers can’t do things on their own. They need a computer program to tell them what to do. Computer programmers write code to make computers do all sort of things.
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!
Lesen Sie weiter in der vollständigen Ausgabe!