At the end of this class, you will be able to:
BONUS: Type like a Hacker
SPACE
SPACE
SPACE
Command (program)
Flag or Option
Output
Let's get to grips with some Terminal commands
Key Objective
Type of Exercise
Timing
15 mins |
|
Key Objective
Type of Exercise
Timing
10 mins |
|
Git is distributed version control system
Local
Remote
jsd-9-resources
jsd-9-homework
git init
.git
subdirectory in the current working directory
git add -A
git add .
Or for individual files
git add filename
git commit
git commit -m "Commit Message"
git branch newbranchname
git checkout -b newbranchname
git checkout –b
command is a shortcut to create the branch and move into it.git checkout branchname
, to return to an existing branch.Let's try out Git Commands
Node | Browser |
---|---|
|
|
|
|
|
|
|
|
Interactive command line
node
at the command prompt..exit
or press CTRL + C
twice
> 3 + 4 // your command
< 7 // Node's response
Running a file
node
and the filepath as the first argument:
> node /filepath/script.js
script.js
file and executes the contents
> 7
Containers for data that allow us to store values
let age;
let age = 32;
let age = 32;
const age = 32;
var age = 32;
anExampleOfCamelCase
numberofbooks
is not the same as numberOfBooks
console.log(age)
console.log
'sA data type provided by a programming language as a basic building block. Examples in JavaScript are:
String
"All strings are wrapped in quotations"Number
15Boolean
true.toUpperCase()
let title = "star wars"
title.toUpperCase();
"STAR WARS"
> 0.1 + 0.2
0.30000000000000004
The standard arithmetic operators are supported, including addition, subtraction & modulus (or remainder)
> 1 + 2;
3
> 2 - 5;
-3
> 5 / 2;
2.5
> 6 * 2;
12
+= | adds a number to a variable and assigns the new value to the same variable |
-= | subtracts a number from a variable and assigns the new value to the same variable |
++ | adds 1 to a value |
-- | subtracts 1 from a value |
> 9 % 4
1
The Math
object provides methods for additional operations
Math.pow(m,n) // Returns m to the power of n
Math.sqrt(n) // Returns the square root of n
Math.random() // Returns a random number between 0 (inclusive) and 1 (exclusive)
Math.floor(n) // Returns largest integer less than or equal to n
Math.ceil(n) // Returns smallest integer greater than or equal to n
A Boolean value can either be true
or false
. Any value can be converted to a boolean value in JS
Key Objective
Type of Exercise
Timing
3 mins |
|
(Lesson 02)