Book Image

JavaScript Projects for Kids

By : Syed Omar Faruk Towaha
Book Image

JavaScript Projects for Kids

By: Syed Omar Faruk Towaha

Overview of this book

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.
Table of Contents (17 chapters)
JavaScript Projects for Kids
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

More operators and operations


JavaScript has more operators other than those stated earlier. Let's go little bit deeper.

Increment or decrement operators

If you have an integer and you want to increment it by 1 or any number, you can type the following:

var x = 4; // assigns 4 on the variable x.
x = x + 1;
/* since x=4, and you are adding 1 with x, so the final value is 4 + 1 = 5, and 5 is stored on the same variable x. */

You can also increment your variable by 1, typing the following:

var x = 4; // assigns 4 on the variable x.
x++; // This is similar to x = x + 1.

What will you do if you want to increment your variable by more than 1? Well, you can follow this:

var x = 4; // assigns 4 on the variable x.
x = x + 3; // Say, you want to increment x by 3.
/* since x = 4, and you are adding 3 with x, so the final value is 4 + 3 = 7, and 7 is stored on the same variable x. */

You can increment your variable by typing the following as well:

var x = 4; // assigns 4 on the variable x.
x += 3; // This is...