Javascript Flashcards
(210 cards)
What is the purpose of variables?
to store data for the future.
How do you declare a variable?
utilizing the var keyword to declare it.
How do you initialize (assign a value to) a variable?
You assign the variable name (identifier) to a value using a single = sign.
What characters are allowed in variable names?
letters, underscore, start with $ or underscore camelCased capitalized letters but numbers cant be in the front.
What does it mean to say that variable names are “case sensitive”?
that the same variable name but with different casing have different variable names.
What is the purpose of a string?
how to hold a sequence of data characters of characters of numbers letters and other characters
What is the purpose of a number?
to store number mainly for math
What is the purpose of a boolean?
to compare expressions as true or false.
What does the = operator mean in JavaScript?
assignment operator.
How do you update the value of a variable?
you set the variable name without the keyword to another variable value
What is the difference between null and undefined?
null is the intentional absence of value where it is an object. it can be assigned but not output by java. but undefined does not have a value assigned to a variable. 1) null get data later or it was never going to be added and you will know. Java outputs undefined so developers should not.
Why is it a good habit to include “labels” when you log values to the browser console?
logging the value without the label makes it unknown what it is being used and where it comes from.
Give five examples of JavaScript primitives.
str, num, undefined, boolean, null
What data type is returned by an arithmetic operation?
numbers
What is string concatenation?
when you combine strings utilizing , or + as any other data type becomes a string
What purpose(s) does the + plus operator serve in JavaScript?
Addition or concatenation
What data type is returned by comparing two values (<, >, ===, etc)?
boolean
What does the += “plus-equals” operator do?
it sets the value of the left side as it self plus what is on the right side
What are objects used for?
objects group together different variables datatypes can group multiple properties in association of the same object as well as being able have multiple similar object with differing properties be better organized.
What are object properties?
piece of data stored in object. easiest method to notate objects with curly brackets being assigned to a variable. with key vales.
Describe object literal notation.
defining the object and assigning to a curly brackets with a property key name : value
How do you remove a property from an object?
delete object.property
What are the two ways to get or update the value of a property?
through appending or using the = operator to the property and giving a value.
Give 6 examples of comparison operators.
> =
<=
<
===
!=