LearningFuze Mod 1 - Javascript Flashcards
What is the purpose of variables?
Variables are used to store information to be referenced and manipulated in a computer program.
How do you declare a variable?
assigning it with a value
How do you initialize (assign a value to) a variable?
by adding an equals (assignment operator) to the var
Ex (var=””)
What characters are allowed in variable names?
a letter a dollar sign $ or an underscore (_) or numbers but they CANNOT be in the start
What does it mean to say that variable names are “case sensitive”?
It relies on camelCase
What is the purpose of a string?
The String object is used to represent and manipulate a sequence of characters.
What is the purpose of a number?
Store numeric value
What is the purpose of a boolean?
it creates true or false statements
What does the = operator mean in JavaScript?
it assigns value
How do you update the value of a variable?
We write the variable name and giving a new value would change it
What is the difference between null and undefined?
undefined is a type by itself (undefined). … Here as the variable is declared but not assigned to any value, the variable by default is assigned a value of undefined. On the other hand, null is an object. It can be assigned to a variable as a representation of no value.
Why is it a good habit to include “labels” when you log values to the browser console?
Because if you do not assign a value it will make a global value and it can break it
Give five examples of JavaScript primitives.
undefined , null , boolean , string and number
What data type is returned by an arithmetic operation?
returns a single numerical value.
What is string concatenation?
joining two or more strings together to make one
What purpose(s) does the + plus operator serve in JavaScript?
It combines two strings and does addition
What data type is returned by comparing two values (
boolean, which is true or false statements
What does the += “plus-equals” operator do?
adds the value of the right operand to a variable and assigns the result to the variable.
What are objects used for?
Its used to model
What are object properties?
Is a variable
Describe object literal notation.
NEEDED
What are the two ways to get or update the value of a property?
.notion or bracket notion
What are arrays used for?
To store values
How are arrays different from “plain” objects?
They are numerical index
Describe array literal notation.
NEEDED
What is the length property of an array?
it records the values in the array
How do you calculate the last index of an array?
length of the array -1
What is a function in JavaScript?
Block of code and call as needed