JavaScript Projects for Kids
()
About this ebook
About This Book
- Get to know the concepts of HTML and CSS to work with JavaScript
- Explore the concepts of object-oriented programming
- Follow this step-by-step guide on the fundamentals of JavaScript programming
Who This Book Is For
If you've never written code before or you are completely new to the world of web programming, then this book is the right choice for you. This book is for kids of age 10 years and above and parents who are completely new to the world of programming and want to get introduced to programming.
What You Will Learn
- Learn how to work with Google Developer tools to iterate, debug and profile your code
- Develop a Battleship game using the basic concepts of HTML and CSS
- Get to know the fundamentals of JavaScript programming
- Create our own version of Pac Man game.
- Discover the vital concepts of object-oriented programming
In Detail
JavaScript is the most widely-used programming language for web development and that's not all! It has evolved over the years and is now being implemented in an array of environments from websites to robotics. Learning JavaScript will help you see the broader picture of web development.
This book will take your imagination to new heights by teaching you how to work with JavaScript from scratch. It will introduce you to HTML and CSS to enhance the appearance of your applications. You’ll then use your skills to build on a cool Battleship game! From there, the book will introduce you to jQuery and show you how you can manipulate the DOM. You’ll get to play with some cool stuff using Canvas and will learn how to make use of Canvas to build a game on the lines of Pacman, only a whole lot cooler! Finally, it will show you a few tricks with OOP to make your code clean and will end with a few road maps on areas you can explore further.
Style and approach
This is an easy-to-follow, informative, and fun guide that takes a project-based approach to teaching programming in JavaScript. You will learn everything you need to get started with serious web application development.
Related to JavaScript Projects for Kids
Related ebooks
JavaScript Unlocked Rating: 5 out of 5 stars5/5JavaScript and JSON Essentials Rating: 5 out of 5 stars5/5Mastering JavaScript Rating: 4 out of 5 stars4/5JavaScript Security Rating: 4 out of 5 stars4/5Learning Bootstrap Rating: 1 out of 5 stars1/5Mastering JavaScript Object-Oriented Programming Rating: 0 out of 5 stars0 ratingsModular Programming with PHP 7 Rating: 0 out of 5 stars0 ratingsLearning Single-page Web Application Development Rating: 0 out of 5 stars0 ratingsLearning jQuery 3 - Fifth Edition Rating: 0 out of 5 stars0 ratingsMastering JavaScript Design Patterns - Second Edition Rating: 5 out of 5 stars5/5ReactJS by Example - Building Modern Web Applications with React Rating: 4 out of 5 stars4/5Reactive Programming for .NET Developers Rating: 0 out of 5 stars0 ratingsGetting Started with React Native Rating: 4 out of 5 stars4/5JavaScript Enlightenment Rating: 4 out of 5 stars4/5JavaScript: Beginner's Guide to Programming Code with JavaScript Rating: 5 out of 5 stars5/5JavaScript: Best Practices to Programming Code with JavaScript: JavaScript Computer Programming, #3 Rating: 0 out of 5 stars0 ratingsResponsive Web Design with HTML5 and CSS3 - Second Edition Rating: 4 out of 5 stars4/5Learning HTML5 by Creating Fun Games Rating: 4 out of 5 stars4/5Object-Oriented JavaScript - Third Edition Rating: 4 out of 5 stars4/5JavaScript: Best Practices to Programming Code with JavaScript Rating: 0 out of 5 stars0 ratingsJavaScript: Tips and Tricks to Programming Code with Javascript Rating: 0 out of 5 stars0 ratingsJavaScript: Advanced Guide to Programming Code with JavaScript Rating: 0 out of 5 stars0 ratingsLearning JavaScript Data Structures and Algorithms Rating: 5 out of 5 stars5/5HTML5 Games: Creating Fun with HTML5, CSS3 and WebGL Rating: 0 out of 5 stars0 ratingsHTML5, JavaScript, and jQuery 24-Hour Trainer Rating: 2 out of 5 stars2/5Object-Oriented JavaScript: Create scalable, reusable high-quality JavaScript applications, and libraries Rating: 3 out of 5 stars3/5Responsive Web Design with HTML5 and CSS3 Essentials Rating: 5 out of 5 stars5/5
Internet & Web For You
Coding For Dummies Rating: 5 out of 5 stars5/5How to Disappear and Live Off the Grid: A CIA Insider's Guide Rating: 0 out of 5 stars0 ratingsHow to Be Invisible: Protect Your Home, Your Children, Your Assets, and Your Life Rating: 4 out of 5 stars4/5Podcasting For Dummies Rating: 4 out of 5 stars4/5Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5Get Rich or Lie Trying: Ambition and Deceit in the New Influencer Economy Rating: 0 out of 5 stars0 ratingsNo Place to Hide: Edward Snowden, the NSA, and the U.S. Surveillance State Rating: 4 out of 5 stars4/5Cybersecurity For Dummies Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5The Gothic Novel Collection Rating: 5 out of 5 stars5/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Six Figure Blogging Blueprint Rating: 5 out of 5 stars5/5Social Engineering: The Science of Human Hacking Rating: 3 out of 5 stars3/5The Digital Marketing Handbook: A Step-By-Step Guide to Creating Websites That Sell Rating: 5 out of 5 stars5/5Remote/WebCam Notarization : Basic Understanding Rating: 3 out of 5 stars3/5The Hacker Crackdown: Law and Disorder on the Electronic Frontier Rating: 4 out of 5 stars4/5The $1,000,000 Web Designer Guide: A Practical Guide for Wealth and Freedom as an Online Freelancer Rating: 5 out of 5 stars5/5Hacking : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Ethical Hacking Rating: 5 out of 5 stars5/5The Designer's Web Handbook: What You Need to Know to Create for the Web Rating: 0 out of 5 stars0 ratingsLearn JavaScript in 24 Hours Rating: 3 out of 5 stars3/5The Beginner's Affiliate Marketing Blueprint Rating: 4 out of 5 stars4/5How To Start A Profitable Authority Blog In Under One Hour Rating: 5 out of 5 stars5/5C++ Learn in 24 Hours Rating: 0 out of 5 stars0 ratingsWeb Designer's Idea Book, Volume 4: Inspiration from the Best Web Design Trends, Themes and Styles Rating: 4 out of 5 stars4/5Stop Asking Questions: How to Lead High-Impact Interviews and Learn Anything from Anyone Rating: 5 out of 5 stars5/5Mike Meyers' CompTIA Security+ Certification Guide, Third Edition (Exam SY0-601) Rating: 5 out of 5 stars5/5
Reviews for JavaScript Projects for Kids
0 ratings0 reviews
Book preview
JavaScript Projects for Kids - FarukTowaha Syed Omar
Table of Contents
JavaScript Projects for Kids
Credits
About the Author
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Exploring JavaScript in the Console
Installing Google Chrome
Installing Atom
Chrome Developer Tools
Our first program
Why do we use Chrome Developer Tools?
Why do we use Atom as the text editor?
Exercise
Summary
2. Solving Problems Using JavaScript
Variables
Comments
Arithmetic operators
Addition
Subtraction
Multiplication
Division
Modulus
More operators and operations
Increment or decrement operators
Assignment operators
JavaScript comparison and logical operators
Summary
3. Introducing HTML and CSS
HTML
Your first webpage
More HTML tags
Coloring HTML text
Linking HTML text
Inserting an image
CSS
JavaScript on an HTML page
Summary
4. Diving a Bit Deeper
JavaScript methods
HTML buttons and form
Buttons
Form
If statement
Switch-case
Exercise
Loops
The for loop
Exercise
The while loop
Exercise
Summary
5. Ahoy! Sailing into Battle
The HTML part
The CSS part
The JavaScript part
The final code
Summary
6. Exploring the Benefits of jQuery
Installing jQuery
Explaining the code
Going deeper
The load() method
The keyup() and keydown() methods
The change() method
The blur() and focus() methods
The resize() method
The scroll() method
Summary
7. Introducing the Canvas
Implementing canvas
Adding JavaScript
Drawing a rectangle
Drawing a line
A quick exercise
Drawing a circle
Draw linear gradient
A quick exercise
Let's make a clock!
Summary
8. Building Rat-man!
Game user interface
Adding functionalities to the game
The app.main.js file
The app.display_functions.js file
The app.init.js file
Images for Rat-man!
The monsters folder
The player folder
The portal folder
The walls folder
Adding images to our cats
Draw the canvas
The app.key_handler.js file
The app.movement_functions.js file
The app.constants.js file
Playing the game
Summary
9. Tidying up Your Code Using OOP
Inheritance in JavaScript
Encapsulation in JavaScript
Dissecting Hangman
Summary
10. Possibilities
JavaScript as your first programming language
JavaScript is everywhere
JavaScript developer as profession
All chores can be done by JavaScript
Robotics
3D games
Making apps for your smartphones
Running web servers
Running Ruby and Python
Writing OS-independent desktop applications
Web scraping and screenshotting
Web analytics
Responsive and interactive contents
Animation
Creating cookies
Awesome JavaScript examples
Summary
Index
JavaScript Projects for Kids
JavaScript Projects for Kids
Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: January 2016
Production reference: 1220116
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78528-717-6
www.packtpub.com
Credits
Author
Syed Omar Faruk Towaha
Reviewer
Johnathan Iannotti
Commissioning Editor
Veena Pagare
Acquisition Editor
Aaron Lazar
Content Development Editor
Sachin Karnani
Technical Editor
Manthan Raja
Copy Editor
Vibha Shukla
Project Coordinator
Nikhil Nair
Proofreader
Safis Editing
Indexer
Mariammal Chettiyar
Graphics
Disha Haria
Jason Monteiro
Production Coordinator
Arvindkumar Gupta
Cover Work
Arvindkumar Gupta
About the Author
Syed Omar Faruk Towaha has degrees in physics and computer engineering. He is a technologist, tech speaker, and physics lover from Shahjalal University of Science and Technology (SUST), Sylhet. He has a passion for programming, tech writing, and physics experiments.
His recent books include Easy Circuits for Kids, Fundamentals of Ruby, and How You Should Design Algorithms. He is an Oracle-certified professional developer currently involved with a number of projects that serve both physics and computer architecture.
He is the president of one of the largest astronomical organizations (Copernicus Astronomical Memorial of SUST (CAM-SUST)) in Bangladesh. He also volunteers for Mozilla as a representative.
I wish to take the opportunity to thank the staff at Packt Publishing for their commitment and hard work, especially Sachin Karnani (Content Development Editor), Aaron Lazar (Acquisition Editor), and Nikhil Nair (Project Coordinator). They got numerous reviews, kept the book on track, and helped me in many ways. I really appreciate their input. I also wish to thank Johnathan Iannotti (Reviewer) for his constructive criticism and helpful comments.
About the Reviewer
Johnathan Iannotti is a software engineer and geek on an epic journey of life. His experience spans 15 years of technology solutions for start-ups, financial companies, healthcare, and military. He is passionate about web technology and has been creating hybrid apps since their inception. A full-stack developer by trade, he loves UX/UI, frontend development, and mobile.
He works for USAA, creating mobile applications for over 27,000 employees that serve their military membership. He is also a combat veteran having served almost a decade in the United States Army.
Johnathan spends his time innovating, coding, and making the best of it all. When he's not plugged in, he spends as much time as he can with his beautiful wife and two children who make it all possible. <3
Follow Johnathan on Twitter at @notticode or visit his website at http://johnforhire.com/.
www.PacktPub.com
Support files, eBooks, discount offers, and more
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Free access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
Preface
As you can guess from the title of the book, this book is designed and set up for kids so that they can teach themselves JavaScript and create some projects using JavaScript.
By abstracting the core web programming in an unparalleled way, JavaScript changed websites and web apps forever. Boring static websites and non-interactive websites have now become quite awesome with the touch of JavaScript. Using JavaScript, you can develop web applications, even smartphone applications too, quickly without compromising quality. You can be very productive and deal with almost no configuration on your hardware and software if you start playing with JavaScript. Please remember that this is not a reference book, but you can learn every basic concepts of JavaScript from it. So, for the kids aged 10 and above, this will be a perfect book to discover the world of JavaScript.
What this book covers
Chapter 1, Exploring JavaScript in the Console, discusses JavaScript and the JavaScript Development Environment, including Google Developer Tools. We will install the necessary software and print a few simple lines of code in this chapter.
Chapter 2, Solving Problems Using JavaScript, covers JavaScript fundamentals from the main syntax to some easy commands in the console. We will learn how variables work and what can be achieved with arithmetic operators. We will also run some simple commands to solve problems inside the console.
Chapter 3, Introducing HTML and CSS, will make real use of JavaScript and will cover HTML, which empowers the readers to make use of JavaScript not only in the console but also in the browser's view. We will also explain the basics of CSS, such as CSS selectors, and CSS layouts.
Chapter 4, Diving a Bit Deeper, covers some of the more advanced features that JavaScript offers. We discuss for and while loops, if statements, and switches-case.
Chapter 5, Ahoy! Sailing into Battle, teaches us how to develop the famous game, Battleship. Building upon what we've learned in the previous chapters, the tiny tots will learn to put this information into use.
Chapter 6, Exploring the Benefits of jQuery, is all about jQuery, a famous JavaScript library, and the advantages of using it.
Chapter 7, Introducing the Canvas, discusses HTML canvas, and we will learn how we can use it on our projects.
Chapter 8, Building Rat-man!, teaches us to develop a famous game, Pac-Man, except there is a rat, some cats, and lots and lots of cheese balls to eat! ;)
Chapter 9, Tidying up Your Code Using OOP, teaches object-oriented programming (OOP) and discusses how JavaScript is an OOP language.
Chapter 10, Possibilities, shows the reader what is possible using the skills they have developed reading this book.
What you need for this book
Throughout this book, we have used Google Chrome as our browser to run our JavaScript code on the console.