KHAN ACADEMY JavaScript
circle
After running the following code, what shape will be the face be? ellipse(200, 170, 150, 150); // face oval? oblong? circle? rectangle?
15
After running this code: var w = 20; var h = 15; rect(10, 10, w, h); ellipse(10, 10, w, h); What will be the height of each of the two shapes?
10
After running this code: var xPos = 10; var yPos = 5; rect(xPos, yPos, 10, 10); At what x position will the rectangle be?
no
Can variable names start with a number?
small letters
Commands in jScript begin with small letters or capital letters.
xPos = 10;
How can we assign xPos to hold the value 10:
400
How many pixels are there on a horizontal line across the javaScript screen?
400
How many pixels are there on a vertical line from top to bottom on the javaScript screen?
below
If a "fill" color command is given, then does it fill what is above or what is below?
yellow
If one "fill" color command of the color black is given and that is followed by a "fill" color command of yellow, which is then followed by an ellipse, then what color will the ellipse be?
xPos = 20;
Initially we gave xPos a value of 10 with the following command: var xPos = 10; Later we want to change xPos to a value of 20. Show the command to change the value. Remember it ends in a ;
var xPos;
Show how we would declare a variable named "xPos"
var xPos = 10;
Show how you declare the variable xPos and give it value of 10.
;
Show what punctuation mark ends commands.
right
Variable names are case sensitive, which means that "xPos" is different from "xpos", right or wrong?
yes
Variable names can begin with letters, or the symbols $ or _. yes or no?
true
Variable names can only contain letters, numbers, $ and _. true or false?
correct
Variable names should use camel case for multiple words, like "toothSize" instead of "toothsize" or "tooth_size". correct or incorrect?
x,y,w,h
What are the 4 factors for a rectangle in JavaScript? Separate by commas.
r,g,b
What are the first letters of each of the 3 main colors in javaScript? Separate by commas.
horizontal
What direction is the x axis? horizontal or vertical?
vertical
What direction is the y axis? horizontal or vertical?
top
Where should the "background" be located? top, middle or bottom?
green
Yellow was the 1st fill command, which is followed by fill command blue, and then by fill command green. If a rectangle is created immediately below those, then what color will appear in the rectangle?
20
var rectWidth = 20; rect(10, 10, rectWidth, rectWidth); How wide is the resulting rectangle?
5
var x = 5; What is the value of x?
55
var xPos = 55; rect(10, 20, 30, 40); ellipse(xPos, 20, 15, 30); ellipse(xPos, 10, 20, 30); At what x position will the ellipse(s) be?