can add one or more element to the end of an array
Back
pop
Front
pulls the last element off of the given array and returns it
Back
Are these acceptable variables?
var 1count
var my name
var *score
var width
Front
no
Back
infinite loop
Front
never ending loop. A programming error, will crash your browser
Back
how to call a function
Front
Name ( ) { }
Back
this
Front
binds a property or function to a class or object
Back
(0,0,255)
Front
Blue
Back
object
Front
A collection of things we can use and reuse
data that has its own properties
- has a period
ex: this . length
Back
system variables
Front
width, height, mouseX, frameRate
Back
undefined
Front
variable, property, method
Back
operators
Front
+, -, *, /, ++, --
Back
global variable
Front
variable outside a function
ex:
var apples
function word{
apples = 100
pears = 50
}
-> apples
Back
array
Front
is how to make a list [...]
let myArray = ["...", "...", "..."]
Back
array
Front
a list - let myArray = [ ]
Back
objects
Front
a collection of things we can use and reuse
Back
data types
Front
two types of numbers within these
1. integers (-1 , 450)
2. Float (o.1 , 12.456)
Back
local variable
Front
variable within a function
Back
single line comment
Front
//...
Back
score vs. Score
Front
var score = new Score
Back
null
Front
when an object has not been defined
Back
global variable
Front
variable outside a function
Back
p5.js
Front
a collection of functions built on JavaScript
Back
function
Front
a block of code that can be executed when called
Back
console
Front
prints text to the console
Back
Are these acceptable variables?
var one_cunt
var _count
var myScore
Front
yes
Back
events
Front
onClick, onMouseOver, onLoad
Back
foo
Front
a placeholder for a value
Back
local variable
Front
variable within a function
ex:
function word( ){
var blah
}
-> var blah
Back
string
Front
lines of text within data types
"frog", "a red truck"
("a word, sentence, or paragraph)
Back
parameter
Front
(variables in here)
(example1, example2)
Back
argument
Front
anything within parenthesis
Back
for loop
Front
allow you to repeat a certain code
Back
constructor function
Front
creates an instance of an object from a class
Back
arguments
Front
Anything with a parenthesis (word,10,5)
ex: find arguments:
var yloc = width/2;
fill (255,0,0);
rect (x,yloc,50,50);
console.log ("y="+yloc)
arguments:
(255,0,0)
(x,yloc,50,50)
("y="+yloc)
Back
declare a variable
Front
var myName = "Mariah"
Back
nested for loops
Front
a loop inside of a loop used for grids
Back
for loops
Front
allows you to repeat a certain code
for (x=0; x<5; x++)
Back
boolean value
Front
true or false
Back
(0,255,0)
Front
Green
Back
.length
Front
prints out how many elements are in an array
Back
string
Front
lines of text within data types
Back
multi line comment
Front
/.../
Back
draw ( )
Front
can happen multiple times - everything you want to animate
Back
parameters
Front
things listed inside parenthesis
Back
function
Front
a block of code that can be executed when called
function Name ( ) {
}
Back
(255,0,0)
Front
Red
Back
console.log
Front
print the data in an HTML like tree
Back
concatenate
Front
adding or combining strings
Back
Section 2
(7 cards)
what will print to the console?
for(let i = 0; i < 5; i++)
console.log (i*10)
what will print to the console?
var apples = 45;
var bananas = 10;
var oranges = 3;
var x = apples - bananas * oranges;
console.log ("the value of x =" + x);
Front
apples - bananas * oranges
45 - 10*3
45 - 30
= 15
("the value of x = 15)
Back
what is wrong?
let things = 0;
if(things = 100){
console.log("you have 100 things!");
}
Front
if (things == 100)
Back
What is wrong here?
1 function Orb(x, y) {
2 this.x = x;
3 this.y = y;
4 this.r = random(50);
5 speed = 2;
6
7 this.display = function () {
8 fill (this.color);
9 ellipse (this.x, this.y, this.r, this.r);
10
11 function update () {
12 this.x += this.speed;
13 if(this.x = width) {
14 x = 0;
15 }
16
JavaScript Object Notation - used to send data back and forth to server and text
Back
gradient
Front
fill (255-x/2)
Back
circle all global variables: how many are circled?
var apples;
var pineapples;
function setup () {
createCanvas (500,500);
apples = 100;
var bananas = 90;
}
function draw () {
apples = apples - bananas;
var oranges = 10;
}