Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
JavaScript Projects for Kids

You're reading from   JavaScript Projects for Kids Gear up for a roller-coaster ride into the world of JavaScript and programming with this easy-to-follow, fun, and entertaining project-based guide

Arrow left icon
Product type Paperback
Published in Jan 2016
Publisher Packt
ISBN-13 9781785287176
Length 188 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Syed Omar Faruk Towaha Syed Omar Faruk Towaha
Author Profile Icon Syed Omar Faruk Towaha
Syed Omar Faruk Towaha
Arrow right icon
View More author details
Toc

Our first program

Now, let's check whether JavaScript works on your machine.

From the tools, select Console. If you cannot find Console, click on the >> symbol, as follows:

Our first program

Once your console is open, type the following code and hit Enter on your keyboard:

document.write("Hello World");

If you can see the output on the left-hand side panel as shown in the following, then you have successfully configured JavaScript on your browser:

Our first program

The output that you will see is as follows:

Hello World

Congratulations!

Note

Downloading the example code

You can download the example code files for all the Packt books that you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register in order to have the files e-mailed to you directly.

If you cannot see the text, check your code or install Google Chrome with administrative rights.

You can also click on the gear button of your console. Check whether Disable JavaScript is unchecked:

Our first program

You can also debug your JavaScript codes using this tool.

If you type anything wrong; consider that you forgot the inverted commas of the Hello World string, you will get the following errors:

Our first program

To speed up writing your codes, you may learn some keyboard shortcuts for both console and Atom text editor.

Here are few keyboard shortcuts for console:

  • Ctrl + L: Clear console
  • Tab: Autocomplete common prefix
  • Right arrow: Accept suggestion
  • Ctrl + U: Clear console prompt
  • Up/Down: Next/previous line
  • Enter: Execute command

Here are few keyboard shortcuts for Atom text editor:

  • Ctrl + B: Browse list of open files
  • Ctrl +Alt + R: Reload Atom
  • Ctrl +Shift + L: Change syntax highlighting
  • Alt +Shift + S: Show available code snippets
  • Ctrl +Shift + M: Markdown preview
  • Ctrl +Alt + I: Toggle Developer Tools
  • Ctrl + N: New file
  • Ctrl +Shift + N: New Window
  • Ctrl + P: Open file (type the name to perform a search)
  • Ctrl + O: Open file
  • Ctrl +Shift + O: Open folder
  • Ctrl + S: Save
  • Ctrl +Shift + S: Save as
  • Ctrl + W: Close tab
  • Ctrl +Shift + W: Close window
  • Ctrl + G: Go to line
  • Ctrl + L: Select line
  • Ctrl +Shift + D: Duplicate line
  • Ctrl +Shift + K: Delete line
  • Ctrl + Up/Down: Move line up/down
  • Ctrl + /: Toggle comment line
  • Ctrl + Enter: New line below
  • Ctrl + [/]: Indent/unindent selected lines
  • Ctrl + J: Join lines
  • Ctrl + Alt + .: Complete bracket
  • Ctrl + M: Go to matching bracket
  • Ctrl + Alt + M: Select code inside matching brackets
  • Ctrl + Alt + /: Fold/unfold code
  • Ctrl + Alt + F: Fold selected code
  • Ctrl + Alt + [/]: Fold/unfold all code
  • Ctrl + F: Find in current file
  • Ctrl + Shift + F: Find in project
  • F3: Find next
  • Shift + F3: Find previous
  • Ctrl + Enter: Replace all
  • Ctrl + Alt + /: Use Regex in search
  • Ctrl + Shift + =/-: Increase/decrease text size
  • Ctrl + 0 (zero): Reset text size
  • F11: Toggle fullscreen
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime