You are on page 1of 18

JavaScript: Getting Started

JAVASCRIPT BASICS

Mark Zamoyta
SOFTWARE DEVELOPER AND EDUCATOR

@markzamoyta
Storing Information in Variables
Introduction Variable Errors
String and Numeric Variables
Simple Operators
Comments
Starting Our Blackjack Application
Storing Information in Variables
GPS Application
- longitude
- latitude
- person
- vehicle
Rocket Ship Application
- name
- fuelType
- launchLocation
- speed
Dinosaur Game
- score
- level
- playerName
- dinoSpeed
Understanding Code Errors
String and Numeric Variables
String and Numeric Variables

Strings Numbers
“Hello World” 42
'Hello World' 0.42
“Don’t Speak!” 52000000
'Welcome to Blackjack' 0.00000052
'We\'re not home'
Simple Operators
Simple Operators

+
Addition
-
Subtraction
*
Multiplication

/ % ( )
Division Remainder Parenthesis
Commenting Code
Comments

// This is a comment
let name = “Jackrabbit” ;
console.log(name);
Comments

//
// This is a comment
//
let name = “Jackrabbit” ;
console.log(name);
Comments

/*
This is a comment
*/
let name = “Jackrabbit” ;
console.log(name);
Comments

let name = “Jackrabbit” ; // actually it’s a nickname


console.log(name);
Starting Our Blackjack Application
Variables
- Declare with let
- Always initialize before use
Summary Variable Errors
String and Numeric Variables
- Concatenation and Addition ( + )

Simple Operators
- + - / * %

Comments
Creating Blackjack

You might also like