JavaScript Flashcards
object literal
var xxx = {}
I can literally see the object
What is the purpose of variables?
to create a memory space for restore values
How do you declare a variable?
var const let
How do you initialize (assign a value to) a variable?
use = == ===
What characters are allowed in variable names?
The period, the underscore, and the characters $, #, and @ can be used within variable names. For example, A. _$@#1 is a valid variable name.
What does it mean to say that variable names are “case sensitive”?
JavaScript is a case-sensitive language. This means that language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.
What is the purpose of a string?
text information
What is the purpose of a number?
numerical information
What is the purpose of a boolean?
true or false
What does the =, ==, === operator mean in JavaScript?
= assign variable
The equality operator (==) checks whether its two operands are equal, returning a Boolean result. Unlike the strict equality operator, it attempts to convert and compare operands that are of different types.
The strict equality operator (===) checks whether its two operands are equal, returning a Boolean result. Unlike the equality operator, the strict equality operator always considers operands of different types to be different.
How do you update the value of a variable?
write the name, reassign value
What is the difference between null and undefined?
null is created by human, means there’s empty for now but not long
Undefined is by machine. telling us item don’t have value
Why is it a good habit to include “labels” when you log values to the browser console?
nice and clear on what are we log in
Give five examples of JavaScript primitives.
undefined , null , boolean , string and number
bigint. for restore crazy big number (astro, bunisess data)
symbol.
What data type is returned by an arithmetic operation?
number
What is string concatenation?
var string += xxx
What purpose(s) does the + plus operator serve in JavaScript?
plus things
What data type is returned by comparing two values (<, >, ===, etc)?
boolean
What does the += “plus-equals” operator do?
Exercise
ob += x
ob = ob + x
What are objects used for?
{xx:pp, xx:pp} like dictionary
What are object properties?
{xx:pp, xx:pp} xx is the property
How do you remove a property from an object?
delete object.object property
What are the two ways to get or update the value of a property?
object.property = value
object[‘property’] = value
What are arrays used for?
restore a list can be count, loop