javascripot Flashcards
What is the purpose of variables?
to store values
How do you declare a variable?
var name
How do you initialize (assign a value to) a variable?
=
What characters are allowed in variable names?
period, undrescore, characters $#@, and letters
What does it mean to say that variable names are “case sensitive”?
a capital letter changes the variable, different variable
What is the purpose of a string?
store characters
What is the purpose of a number?
numerical value to math or store
What is the purpose of a boolean?
gives true/false values
What does the = operator mean in JavaScript?
assign value
How do you update the value of a variable?
assign a new value to the variable
What is the difference between null and undefined?
null is intentionally undefined, undefined was just never given any value
Why is it a good habit to include “labels” when you log values to the browser console?
so you know what is logging what in longer code.
Give five examples of JavaScript primitives.
undefined, null, boolean, string and number
What data type is returned by an arithmetic operation?
number
What is string concatenation?
appending a string onto another string
What purpose(s) does the + plus operator serve in JavaScript?
arithmetic addition and string concatenation
What data type is returned by comparing two values (, ===, etc)?
boolean
What does the += “plus-equals” operator do?
sets the value to the value plus the number
What are objects used for?
groups set of variables and functions to create a model of something
What are object properties?
a variable that is part of an object
Describe object literal notation.
setting a var object = {}
How do you remove a property from an object?
using the delete keyword
What are the two ways to get or update the value of a property?
dot notation and bracket notation
What are arrays used for?
set of values related to each other, a list
Describe array literal notation.
var array = []
How are arrays different from “plain” objects?
What number represents the first index of an array?
0
What is the length property of an array?
How many values are int he array
How do you calculate the last index of an array?
.lenght-1
What is a function in JavaScript?
set of code that takes arguments and can be called
Describe the parts of a function definition.
function operator-name of function(parameters) { }
Describe the parts of a function call.
function(arguments);
When comparing them side-by-side, what are the differences between a function call and a function definition?
function definition uses function keyword, calling uses the function name and arguments.