JavaScript (Junior Side) Flashcards
(169 cards)
What is the purpose of variables?
they are a way to store information so that we can come back to it later.
What is the purpose of a boolean?
To make logical decisions.
How do youdeclarea variable?
by using var, const, or let
How do you initialize (assign a value to) a variable?
By using the assignment operator ( = )
What characters are allowed in variable names?
letter, number, or dollar sign $
What does it mean to say that variable names are “case sensitive”?
capitalized and lowercase letters, even if they are the same letter, will have two different values if assigned to a variable
What is the purpose of a string?
For storing a sequence of characters that javScript will not try to interpret / creating “text”
What is the purpose of a number?
For numbers that may / will be used in mathematical operations
How do you update the value of a variable?
put the name of the variable with an assignment operator and a new value.
Do not use the “var, let, or const” keywords, because the variable has already been declared.
What does the=operator mean in JavaScript?
assigns the value of its right operand to its left operand.
What is the difference betweennullandundefined?
Null is an intentional assignment of no value.
Undefined is an empty value that JS is ‘free to use’
Why is it a good habit to include “labels” when you log values to the browser console?
For clarity when coming back to reference code at a later time.
Give five examples of JavaScript primitives
String, number, boolean, null, undefined
What data type is returned by an arithmetic operation?
Number
What is string concatenation?
adding strings together to make a new string
Does concat change the original string?
No, it makes new strings that consist of the previous strings
What purpose(s) does the+plus operator serve in JavaScript?
math or concatenation
What data type is returned by comparing two values (<,>,===, etc)?
boolean
What does the+=”plus-equals” operator do?
makes a lasting change / adds and assigns
What are objects used for?
a way to group together sets of data that are related to each other
What are object properties?
variables inside of an object
Describe object literal notation.
curly brace, then a property, the a colon, then a comma, then the next property declaration, etc., ended by a closing curly brace
How do you remove a property from an object?
use the delete operator
What are the two ways to get or update the value of a property?
dot notation or bracket notation