Icebreaker game for Day 1
Everyone gets a letter and a number coming into the classroom That is their letter is their variable
https://www.youtube.com/watch?v=HWRnnfkeEW8
Think of your name as a variable
Your name can change but you don't change
Jen = me
Variables allow you to store, find and change information in a program
- Strings - A series of characters (letters, numbers, spaces, symbols in quotes )
- Integers - Numbers
- Array
Store information
jen.eyes = 'green'
A lot of times in Math you with use a variable to represent a number like:
X = 5
Y = 4
The Value of X is ? 5
The Value of X is ? 4
So then X + Y = 9
Today the letter you were given will represent you.
My Letter is A
so the variable llama = 'Jen' or "Jen"
A String is
The
python
var x = 47
javascript
var x = 47
let y = 23
const = 3
var instructors = ['Jen', "Greg', 'Lionel', 'Other']
Allows is to contol what the program does
if this
then that
Repeat a section of code a set number of times until the process is complete
properties values
var jen = {id:1, firstName: 'Jen', lastName: 'Diamond', email: '[email protected]'}
var jen = {id:1, firstName: 'Jen', lastName: 'Diamond', email: '[email protected]'}
$ jen.name >> 'Jen'
var instructors = [
{id:1, firstName: 'Jen', lastName: 'Diamond', email: '[email protected]'},
{id:1, firstName: 'Lionel', lastName: 'X', email: '[email protected]'},
{id:1, firstName: 'Greg', lastName: 'Santos', email: '[email protected]'},
{id:1, firstName: 'Jen', lastName: 'Diamond', email: '[email protected]'},
]
Classes hold information about an Object. It is used as a blue print from which you can ceate a new Object
class Animal {
constructor(name) {
this.name = name;
}
speak() {
console.log(this.name + ' makes a noise.');
}
}
class Dog extends Animal {
constructor(name) {
super(name); // call the super class constructor and pass in the name parameter
}
speak() {
console.log(this.name + ' barks.');
}
}
var d = new Dog('Mitzie');
d.speak(); // Mitzie barks.
var r = new Rectangle()
undefined
r
Rectangle {height: undefined, width: undefined}
r.height = 10
10
r
Rectangle {height: 10, width: undefined}
r.width = 20
20
r
Rectangle {height: 10, width: 20}
---
var rect = new Rectangle(10, 10);
console.log(square.area); // 100