
JavaScript All-in-One For Dummies
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
JavaScript All-in-One For Dummies saves you shelf space by offering a complete introduction to JavaScript and how it's used in the real world. This book serves up JavaScript coding basics before diving into the tools, libraries, frameworks, and runtime environments new and experienced coders need to know. Start by learning the basics of JavaScript and progress through the techniques and tools used by professional JavaScript developers, even if you've never written code before. You also get the details of today's hottest libraries and frameworks--React.js, Vue.js, Svelte, and Node.js.
* Learn the basics of web and application development with the JavaScript language
* Grasp the similarities and differences between React.js, Vue.js, and Svelte
* Discover how to write server-side JavaScript and how to access databases with Node.js
* Gain a highly marketable skill, with one of the most popular coding languages
* Launch or further your career as a coder with easy-to-follow instruction
* This is the go-to Dummies guide for future and current coders who need an all-inclusive guide JavaScript.
This is the go-to Dummies guide for future and current coders who need an all-inclusive guide to the world of JavaScript.
More details
Other editions
Additional editions

Person
Content
Book 1: JavaScript Fundamentals 7
Chapter 1: Jumping into JavaScript 9
Chapter 2: Filling Your JavaScript Toolbox 41
Chapter 3: Using Data 63
Chapter 4: Working with Operators and Expressions 81
Chapter 5: Controlling Flow 91
Chapter 6: Using Arrays 105
Chapter 7: Making and Using Objects 125
Chapter 8: Writing and Running Functions 139
Chapter 9: Getting Oriented with Classes 167
Chapter 10: Making Things Happen with Events 181
Chapter 11: Writing Asynchronous JavaScript 197
Chapter 12: Using JavaScript Modules 223
Book 2: Meet Your Web Browser 231
Chapter 1: What a Web Browser Does 233
Chapter 2: Programming the Browser 241
Book 3: React 261
Chapter 1: Getting Started with React 263
Chapter 2: Writing JSX 281
Chapter 3: Building React Components 297
Chapter 4: Using Data and Events in React 327
Book 4: Vue 341
Chapter 1: Getting an Overview of Vue 343
Chapter 2: Introducing Vue Components 357
Chapter 3: Making Vue Templates 369
Chapter 4: Using Data and Reactivity 395
Chapter 5: Responding to Events 411
Book 5: Svelte 421
Chapter 1: Getting Started with Svelte 423
Chapter 2: Building with Components 437
Chapter 3: Designing Templates 451
Chapter 4: Using Directives 463
Chapter 5: Using the Component Lifecycle 471
Chapter 6: Advanced Svelte Reactivity 483
Book 6: Sharpening Your Tools 493
Chapter 1: Building from Scratch 495
Chapter 2: Optimizing and Bundling 513
Chapter 3: Testing Your JavaScript 535
Book 7: Node.js 557
Chapter 1: Node.js Fundamentals 559
Chapter 2: Streaming 587
Chapter 3: Working with Buffers 603
Chapter 4: Accessing the File System 613
Chapter 5: Networking with Node 627
Chapter 6: Using Events 639
Chapter 7: Error Handling and Debugging 651
Chapter 8: Accessing Databases 673
Chapter 9: Riding on the Express Train 697
Chapter 10: Registration and Authentication 721
Index 755
Introduction
"Do your work, and you shall reinforce yourself."
-RALPH WALDO EMERSON
The following scenario plays out at some point in the career of every developer working on mobile or web apps today:
You show up at your new job (or new freelance gig). You were good enough at using JavaScript that you got hired, and now you're feeling confident that you can start making contributions quickly.
The HR manager gives you a tour and brings you to your new desk - or maybe you work at home or at your local coffee shop. You log in to your new email account and see a message from your manager:
- Welcome to the team! Normally, we'd give you a few weeks to get settled in, but we're slammed and I'm hoping you can get working on some code right away.
- This morning, please log in to Slack and clone our repo, and we'll get you started on some low-level tasks. A couple of things you should know first are that we use a feature branch workflow, we enforce Google style with ESLint, and we unit-test with Mocha and Chai. Everything is Jamstack with MERN on the back end. The API isn't fully documented yet, but it's REST, and you should be able to figure out the endpoints by poking around with Postman. Here are a few small tasks where we could use your help today:
- Figure out why the refresh token isn't getting set in some cases.
- Our code splitting is suboptimal. Take a look at the webpack config and see whether you can improve the situation.
- Speaking of suboptimal, we have some unnecessary Sass in the login module that may be slowing down our build and load times and should be converted to CSS Modules.
- Our ticker widget still relies on jQuery (ha-ha!), and we need to refactor that out before we ship so that we don't embarrass ourselves.
- Okay, that should be enough for today. We have our weekly stand-up tomorrow morning, and we can get you started on something more important then. Don't hesitate to reach out if you have questions!
Your palms start to sweat as you reread the message. You were told you'd be working with JavaScript. What's all this stuff? Sass? You know how to deal with unnecessary sass from your dog. .
You grab on to the part about jQuery. You recall reading about it in one of your books, and you're pretty sure you understand it. But why does the manager think it's so funny?
You close your email and go to the cafe to order a chai mocha latte and a Jamstack sandwich and have a rest in order to think about whether you really and truly need this job.
Why This Book?
I wrote this book because I've been in the situation just described numerous times in my career as a full-stack developer. Maybe you've already had an experience like that one and you want to make sure you're better prepared next time. Maybe you're going through this experience right now. Maybe you want to try to prevent this from happening to you as you begin your career in JavaScript programming. If you fit into any of these categories, this book is for you.
Software development is a dynamic craft. A good part of your responsibility as a professional programmer is to learn new things constantly. The world of JavaScript, however, is notoriously dynamic. Something you learn this year will likely be out of style or at least vastly different next year. There's no sense in fighting the current by sticking to your tried-and-true methods and tools. Many times, if not most of the time, new libraries and tools catch on quickly in JavaScript because they're genuinely useful and superior to the previous ones.
Learning new things can be difficult, and learning new things under pressure to begin using them on real-life projects can be particularly stressful unless you're properly prepared with the right attitude and sufficient experience.
My goal with this book is to prepare you to understand and work with JavaScript and JavaScript programmers. If you read this entire book, you'll understand much of what the manager in the scenario I described earlier said - and maybe even what to do about it. You'll also be well-equipped to continue your learning and to ask the right questions when something you haven't heard of comes up next time.
JavaScript is a huge topic
Programmers create new ways of working with JavaScript all the time and package them as libraries and frameworks that can be downloaded and used by other programmers. Think of libraries as tools to solve a particular problem in a different way. Think of a framework as a complete system for doing particular things.
No single person can know and remember every JavaScript library and framework that's been created. And there's really no need to. By definition, a JavaScript library or framework is just JavaScript. In theory, if you know JavaScript, you can learn every JavaScript library and framework. In fact, if you know enough about JavaScript, you can write your own JavaScript library or framework!
How this book is different
Most books about JavaScript focus on either teaching the JavaScript language itself, or on focusing on a single library or framework. Both approaches have their merits, but both leave out a vital ingredient for becoming a JavaScript programmer.
Learning to program with JavaScript isn't fundamentally about memorizing syntax or knowing every function available in a library or framework. If you know and understand the basics, you can look up everything else easily enough. Furthermore, if you spend a lot of time learning every function and feature of a particular library from a book, you'll be frustrated when you go to use it and find that much has changed in the time (whether it's a month or several years) since the book was published.
In my experience, it's much better to learn just enough about as many different ways of doing things as possible, so that when you encounter something new, you'll have something to compare it to.
Learn JavaScript as it's used
Knowing how to write JavaScript isn't enough to be able to develop apps. JavaScript lives in an environment, whether it's a web browser, a mobile phone, a web server, or a hardware device. Once you get to a certain level of proficiency with JavaScript, knowing how JavaScript interfaces with its environment is what's most important.
This book shows you how JavaScript is used in the real world, using a combination of real-world and simplified examples.
Understand similarities between the most popular libraries
Learning about a single library - whether it's React or Vue.js or Svelte or Angular - is great. But without knowledge of other ways of doing things, you may fall into the trap of thinking that every problem can be best solved by the tool you know.
If you learn a wide variety of tools, you'll understand how libraries and frameworks are constantly improving on what's been done before, and you'll gain an appreciation for why change is so important in the JavaScript world.
Adapt to new technologies
Another benefit of learning multiple ways to do the same thing is that you'll find that the more you learn, the easier it becomes to learn additional tools. One trait of outstanding JavaScript programmers is that they're excited by opportunities to learn new libraries and tools.
Conventions Used in This Book
This book is designed for readers who have some experience with programming or web development and who want to learn not only JavaScript but also how to apply it. Topics I describe in this book include how to
- Write JavaScript code using the most modern and up-to-date syntax
- Use the development tools used by professional JavaScript programmers
- Build reactive user interfaces with ReactJS
- Build reactive user interfaces with Vue.js
- Build reactive user interfaces with Svelte
- Write server-side JavaScript with Node.js
- Connect to data sources with Node.js
- Build a complete back-end application using Node.js
- Connect a front-end user interface to a Node.js back end
As you read this book, keep the following information in mind:
- The book can be read from beginning to end, but feel free to skip around, if you like. If a topic interests you, start there. You can always return to earlier chapters, if necessary.
- At some point, you will get stuck and the code you write won't work as intended. Do not fear! You can find many resources to help you, including support forums, others on the Internet, and me! You can email me directly at
chris@minnick.comor message me on Twitter, Mastodon, or through my website (www.chrisminnick.com). Additionally, you can submit a ticket and find additional code at my GitHub repo for this book, athttps://github.com/chrisminnick/javascriptaio. - Code in the book appears in a monospaced font, like this:
<h1>Hi there!</h1>.
Foolish Assumptions
I do not make many assumptions about you, the reader, but I do make a few.
- I assume that you have some experience or familiarity with HTML and CSS. Many of the applications I show you how to develop make use of both fundamental...
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.