Javascript Flashcards
What is purpose of variables
To assign a value to them
How do you declare a variable
var variable;
How do you initialize (assign a value to) a variable
var variable = ‘value’
What caracters are allowed in variable names?
numbers and some signs $
What does it mean to say that variable names are “case sensitive”?
variable is different from Variable they can have two different values
What is the purpose of a string?
to store and pass around a series of characters, so text
What is the purpose of a number?
Math and quantities
What is the purpose of a boolean?
True and False decision making
what does the = operator mean in JavaScript?
It gives value to a variable
How do you update the value of a variable?
Assign it a new value
What is the difference between null and undefined?
It’s intentional to put null
null always needs to be assigned a value whereas undefined wasn’t assigned anything
Why is it a good habit to include “labels” when you log values to the browser console?
Gives us a point of reference
Give five examples of JavaScript primitives
String, number, boolean, null, and undefined
What are objects used for?
Place to store multiple values
What are object properties?
pieces of data glued onto an object
Describe object litertal notation
The syntax to create an object
How do you remove a property from an object?
using the operator delete
What are the two ways to get or update the value of a property?
using dot notation or bracket notation
What are arrays used for?
To store value inside at specific indexs
Describe array literal notation
var something = []; and each value is separated by a comma
How are arrays different from “plain” objects?
0
What is the length property of an array?
Tells us how many items are in the array
How do you calculate the last index of an array?
length - 1 and you’ll be able to get the final index
What is a function in JavaScript?
A set of instructions that is repeatable
Describe the parts of a function definition.
function name(parameter){ parameter must be present; return value; }
Describe the parts of a function call
console.log(nameOfFunction(arguments));
When comparing them side-by-side, what are the differences between a function call and a function definition?
Calling is utilizing the function and the defining it is making the expression that you want it to function key word is the most notable difference between the two