https://ebookmass.com/product/javascript-all-in-one-fordummies-1st-edition-chris-minnick/
Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...
Coding All-in-One For Dummies Chris Minnick
https://ebookmass.com/product/coding-all-in-one-for-dummies-chrisminnick/
ebookmass.com
HTML, CSS, & JavaScript All-in-One For Dummies 1st Edition
Paul Mcfedries
https://ebookmass.com/product/html-css-javascript-all-in-one-fordummies-1st-edition-paul-mcfedries/
ebookmass.com
Coding Alles-in-einem-Band für Dummies Chris Minnick
https://ebookmass.com/product/coding-alles-in-einem-band-fur-dummieschris-minnick/
ebookmass.com
Bad Blood (The Witches of Cleopatra Hill Book 12)
Christine Pope
https://ebookmass.com/product/bad-blood-the-witches-of-cleopatra-hillbook-12-christine-pope/
ebookmass.com
Art History for Comics: Past, Present and Potential
Futures Ian Horton
https://ebookmass.com/product/art-history-for-comics-past-present-andpotential-futures-ian-horton/
ebookmass.com
War, Revolution, and Nation-Making in Lithuania, 1914–1923
Tomas Balkelis
https://ebookmass.com/product/war-revolution-and-nation-making-inlithuania-1914-1923-tomas-balkelis/
ebookmass.com
John Webster’s Borrowing R. W. Dent
https://ebookmass.com/product/john-websters-borrowing-r-w-dent/
ebookmass.com
Methods of Fundamental Solutions in Solid Mechanics Hui Wang
https://ebookmass.com/product/methods-of-fundamental-solutions-insolid-mechanics-hui-wang/
ebookmass.com
Atheist overreach : what atheism can’t deliver Smith
https://ebookmass.com/product/atheist-overreach-what-atheism-cantdeliver-smith/
ebookmass.com
(Morcster Chef Book 2) Actus
https://ebookmass.com/product/into-the-fire-a-litrpg-fantasy-cookingadventure-morcster-chef-book-2-actus/
ebookmass.com
JavaScript®
ALL-IN-ONE
by Chris Minnick
JavaScript® All-in-One For Dummies®
Published by: John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030-5774, www.wiley.com
Copyright © 2023 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. 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 AUTHORS HAVE USED THEIR BEST EFFORTS IN PREPARING THIS WORK, THEY MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES REPRESENTATIVES, WRITTEN SALES MATERIALS OR PROMOTIONAL STATEMENTS FOR THIS WORK. THE FACT THAT AN ORGANIZATION, WEBSITE, OR PRODUCT IS REFERRED TO IN THIS WORK AS A CITATION AND/ OR POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE PUBLISHER AND AUTHORS ENDORSE THE INFORMATION OR SERVICES THE ORGANIZATION, WEBSITE, OR PRODUCT MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING PROFESSIONAL SERVICES. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR YOUR SITUATION. YOU SHOULD CONSULT WITH A SPECIALIST WHERE APPROPRIATE. FURTHER, READERS SHOULD BE AWARE THAT WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ. NEITHER THE PUBLISHER NOR AUTHORS SHALL BE LIABLE FOR ANY LOSS OF PROFIT OR ANY OTHER COMMERCIAL DAMAGES, INCLUDING BUT NOT LIMITED TO SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR OTHER DAMAGES.
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 https://hub.wiley.com/community/support/dummies.
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: 2023933800
ISBN 978-1-119-90683-4 (pbk); ISBN 978-1-119-90684-1 (ebk); ISBN 978-1-119-90685-8 (ebk)
CHAPTER
CHAPTER
Book 5: Svelte
CHAPTER 4: Using Directives
CHAPTER 5: Using the Component Lifecycle
CHAPTER 6: Advanced Svelte Reactivity
Book 6: Sharpening Your Tools
CHAPTER 1: Building from Scratch
CHAPTER 2: Optimizing and Bundling
CHAPTER 3: Testing Your JavaScript
Book 7: Node.js
CHAPTER 1: Node.js Fundamentals
CHAPTER 2: Streaming
CHAPTER 3: Working with Buffers
CHAPTER 4: Accessing the File System
CHAPTER 5: Networking with Node
CHAPTER 6: Using Events
CHAPTER 7: Error Handling and Debugging
CHAPTER 8: Accessing Databases
CHAPTER 9: Riding on the Express Train
CHAPTER 10: Registration and Authentication 721 Index
Using
Removing
Selecting
Using
Using JavaScript Expressions in JSX
Conditionally Rendering JSX
Conditional
Conditional rendering with &&
3: Making Vue Templates
Responding to Events
Handling
Creating
Making Modules
Refactoring index.js
The moveBall() function
The generateMap() function
Learning
Node.js bindings
The Node.js standard library
Introducing the Node.js Core Modules
Recognizing What Node.js Is Good For
Why is Node.js so fast?
What is Node.js not good at?
Working with Node.js
Writing a Node.js program
Monitoring your script
Running a code on the command line
Using REPL
Playing with the Node.js REPL
Working with REPL commands
Making and Using Node.js Modules
Using CommonJS
Using ES modules
Setting the module type in package.json
Getting Data to Node Modules
Environment variables
Passing arguments
Node’s Callback Pattern
CHAPTER
3: Working with Buffers
Decoding
Using Other Buffer Methods
Iterating over Buffers
CHAPTER 4: Accessing the File System
Reading
Reading
Writing
Using fs .writeFile()
Using
Getting
Listing
Finding
Getting
Discerning
CHAPTER 9: Riding on the Express Train
Introduction
“Do your work, and you shall reinforce yourself.”
T—RALPH WALDO EMERSON
he 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