JS Programing - Khan akademy basic Flashcards
To memorise the main ideas of each session
How many types of variables do you know?
- One value variable
- Arrays []
- Objects { }
- Function () {}
How do you debug, what function do you use?
Println ()
How do you Draw: a line, a rectangle, an ellipse, a circle
line (x, y, Hight, With)
rect (x, y, Hight, With)
ellipse (x, y, Hight, With)
ellipse (x, y, Hight, Hight)
What function is looping continuously (used for animation)?
Draw () { };
What loop functions do you know?
While ( ) { }
For ( ) { }
Draw ( ) { }
How do you call a “For” function and what is it’s structure?
It is a Loop Function
For (var i=1; i>10; i++) { };
How do you call a while function and what is it’s structure?
It is a Loop function.
Var i=1;
while (i<10) {
i++;
};
Do you know any conditional statement?
The if () { } statement.
What is the structure of the if statement. What other if structures are available in Java Script?
if (condition is true) { };
If (condition) { }; else { };
if (condition) { }; else if (condition) { }; else { };
What function will deliver the x and y coordinates of the mouse’s position?
Mouse X
Mouse Y
What conditional function is true if the mouse is pressed?
MouseIsPressed ();
How can you incerease or decrease the value of a variable (i) by 1?
i = i + 1; i = i - 1;
i++; i–;
What type of data do you know?
text
integer
boolean
From where did the boolean data type got its name and what values can it have?
The name is from George Boolean.
Values: True False
How can you incerease the value of a variable (i) by 14
How can you decrease the value of a variable (i) by 14
i = i + 14; i = i - 14;
i += 14; i -= 14
What operators do you use to check if two values are equal?
What operators do you use to check if two values are NOT equal?
i === y;
i !== y;
What operators do you use for AND?
&&
What operator do you use for OR?
||
How can you round a number up?
Ceiling ()
Round () - if the number is equal or higher that 0.5
How can you round a number down?
Floor ();
Round () - if the number is lower than 0.5
How do you make an object without a contour?
noStroke ();
How do you write a text in JS?
text (x, y, hight, with)
What is the structure of a function?
Without input: () { };
With input: function (data1, data2, …) { };