xxxxxxxxxx
38
// function declaration, definition
function sandwich(sandwichType) {
console.log("I making a sandwich.");
console.log("It is a " + sandwichType + " sandwich.");
}
// invoke, run, call function
sandwich("peanut butter and jelly");
sandwich("bologna");
function greet(greeting, name) {
console.log(greeting + ", " + name);
}
greet("Hello", "Jerry");
greet("Hi", "Jenny");
var x;
var y;
function assign() {
// var x = 0;
// var y = 1;
x = 0;
y = 1;
}
function add() {
console.log(x + y);
}
assign();
add();
function setup() {
createCanvas(400, 400);
background('blue');
sandwich();
}