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
How are arrays different from “plain” objects?
Objects represent a special data type that is mutable and can be used to store a collection of data (rather than just a single value). Arrays are a special type of variable that is also mutable and can also be used to store a list of values.
What number represents the first index of an array?
array[0]
What is the length property of an array?
how many number of item in array
How do you calculate the last index of an array?
array.length-1
What is a function in JavaScript?
a set of code we can reuse, and deal with information .
Describe the parts of a function definition.
A function has three parts, a set of inputs, a set of outputs, and a rule that relates the elements of the set of inputs to the elements of the set of outputs in such a way that each input is assigned exactly one output.
Describe the parts of a function call.
call with argument
When comparing them side-by-side, what are the differences between a function call and a function definition?
call give argument, definition set pramater.
What is the difference between a parameter and an argument?
parameter is the placeholder
argument is the actually value
Why are function parameters useful?
Parameters allow us to pass information or instructions into functions and procedures .