What is a variable? What do we use them for? How do we create (aka declare) them? |
A function is essentially an entity within a code that stores data. We can use them for a lot of things, mainly within functions, where they can be either an input or output. We declare them by simply writing the word var in the script section of the html file. |
What is a function? What is their structure? What is their syntax/structure? |
A function is basically a line of code that takes in an input, and gives an output based on that input. They operate on an input-output structure. The syntax of a function is function (input){output}. |
When do we use conditional statements (i.e. if else statements? What is their syntax and structure? | We use if and else statements when we want different things to happen when variables, function outputs, or user inputs are different. Their syntax is if 'data type' =/>/< 'data type', on the next line, whatever code you want to run if the if statement is true. Then, you can add an else statement to follow up with the same syntax. |
What are the different types of data in javascript? | Strings, numbers, and booleans are the three main data types. |
What is an event listener? When do we use them? What is their syntax/structure? | An event listener kinda just listens for an event to happen. It's a function used when we want something to run when something else happens, like, say, a click, for example. And event listener can recognize actions by the user, such as clicks and mouse movement. |
What is an array? When do we use them? How do we make and write them? | An array is a list of data points stored within a single variable. We use them usually when we want to select a random data point from a single variable, or if we want to made code more efficient. We write them like var variablename = ['data point', 'data point', 'data point', etc]. |
What is Math.random()? What does it do? When do we use it? | Math.random is a function that generates a random number. We use it when we want a random numerical value that we can either use directly for something, or so that we can use the numerical value to correspond to something on an array. |
Is Rick Astley ever going to give you up? | No. |
Is he going to let you down? | No. He never will. |