Javascript Basics

JavaScript is a very powerful coding language that runs on modern web browsers such as Chrome, Firefox and Internet Explorer and many other computers in different ways.

For the basics we will concentrate on web browsers as anyone viewing this on a computer already has everything they would need to go ahead and try out some javascript.

Value Types

In JavaScript variables can be set to different values.  The type of values which can be used are as follows.

  • number
  • string
  • boolean
  • object
  • function
  • undefined

Branches

Branches consist of if statements and switch statements that will send the program execute down one path or another depending on given conditions.

For instance continuing the example from above lets use a type of ball as a way to demonstrate using a branch to set the cost of the ball.