returns number of milliseconds that elapsed since the sketch began
Back
What color will the following code draw to the background?
var myNumber = 37;
if(myNumber > 75){
background(255,0,0);
} else if (myNumber > 50){
background(0,255,0);
} else if (myNumber > 25){
background(0,0,255);
} else {
background(255);
}
Front
blue (r,g,b)
Back
Select the allowable variable names
Front
one_count;
var_count;
Back
How would I access the array element containing "h"?
var letters = [["x", "m", "l"],["h","i","s"],["t", "v","q"]];
Front
consol.log(letters[1][0]);
Back
By default a text file is loaded as what?
Front
an array of words
Back
In the following code, what is an argument?
var yloc = width/2;
fill(255);
var score = millis();
var newScore = yloc * score;
Front
255
argument is something you pass into a function
Back
What is the syntax for making a multi-line comment?
Front
/comment/
Back
Which of the following are loops in JavaScript/p5.js?
Front
for each
for
while
Back
What does the this keyword do inside a constructor function?
Front
It binds a property to a particular object/instance.
Back
What will the following code print to the console?
for(let i = 0; i < 5; i++){
console.log(i*10);
}
Front
0, 10, 20, 30, 40
Back
If I wanted to find the proportional equivalent of a value what function should I use?
Front
map()
Back
What function would I use to round a number down to the nearest integer?
Front
floor()
Back
What does the modulo operator (%) do?
Front
returns the remainder of the division operation
Back
What function do you use to add an element to the end of an array?
Front
push()
(pop removes from end)
Back
What is wrong with the following code?
let things = 100;
if(things = 100){
things = things * 5;
console.log("you have " + things + " things!");
}
Front
use "==" to test for equality
Back
What is a constructor function and what does it do?
Front
It creates an object from a class
Back
What is a two-dimensional array?
Front
an array that holds other arrays
Back
What code would I use to remove "banana" from the array?
let fruits = ["apple", "banana", "kiwi", "strawberry", "watermelon"];
Front
fruits.splice(1,1)
Back
In JavaScript/p5.js how do we add a line break to a string?
Front
|n
Back
var apples;
var pineapples;
function setup(){
createCanvas(500,500);
apples = 100;
var bananas = 90;
}
draw(){
var oranges = 10;
apples = apples - oranges;
}
Front
apples
pineapples
Back
What is the logical symbol for OR?
Front
||
Back
What does the translate() function do?
Front
moves the point of origin to a new location
Back
What will the following code print out 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
the value of x = 15
Back
Which of the following is NOT a system variable.
Front
let
Back
What values are used to define polar coordinates?
Front
angle and distance
Back
What does the ++ symbol do?
Front
adds one to the value of the variable
Back
How many radians are there in a circle?
Front
2 * PI
Back
A boolean value can equal what values?
Front
1 or 0
true or false
Back
What equation can we use to find the distance between two points?
Front
Pythagorean theorem
Back
Which of the following is not a type of variable in JavaScript/p5.js?