JavaScript Concepts Flashcards

1
Q

What data type is returned by an arithmetic operation?

A

Number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is string concatenation?

A

its when you combine strings using the + operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What purpose(s) does the + plus operator serve in JavaScript?

A

for numbers, it acts as the addition operator. 2+ 3 = 5

for strings, it acts as a concatenator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What data type is returned by comparing two values < , > , === , etc )?

A

boolean, either true or false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does the += “plus-equals” operator do?

A

it is a shortcut command.

if word += 5 is the same as word = word + 5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the purpose of variables?

A

to assign a value for later reference. var area = 3 * 2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you declare a variable?

A

by using the keywords var , let , const

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you initialize (assign a value to) a variable?

A

by using the = sign

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does it mean to say that variable names are “case sensitive”?

A

if the cases in the variable name are not matched exactly, an error will show

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the = operator mean in JavaScript?

A

it is used to set values of variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you update the value of a variable?

A

by using the variable name then the equal sign, followed by new value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are objects used for?

A

a collection of properties where those properties can have their own values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are object properties?

A

they are variable names that are attached to the object and they can have their values. The values can be different types but the properties are strings.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Describe object literal notation.

A
var obj = {
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you remove a property from an object?

A

delete nameOfObject.PropertyToDelete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the two ways to get or update the value of a property?

A

dot notation or bracket notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What data type is returned by an arithmetic operation?

A

Numbers, including NaN since its type is number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is string concatenation?

A

when you condense 2 or more strings into 1 string using the + operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What purpose(s) does the + plus operator serve in JavaScript?

A

for strings it will be used to concatenate
for numbers it is used to add
for string + number it will concatenate by turning the number into a string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is a function in JavaScript?

A

a formula, can be customized by you to take 0, 1, or more arguments. It will return a value., if you do not use return it will return undefined

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Describe the parts of a function definition.

A

function key word, function name, parenthesis, and parameters (optional)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Describe the parts of a function call.

A
function name followed by (arguments here)
example.  greet('tom')
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

When comparing them side-by-side, what are the differences between a function call and a function definition?

A

function definition is just the code that you wrote, it will not run until it is called with ()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is the difference between a parameter and an argument?

A

parameters are used when a function is declared. argument are the values that are passed into the parameters when the function is called

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Why are function parameters useful?
you can use them as variables, which gives way more flexibility to do stuff
26
What two effects does a return statement have on the behavior of a function?
1) it ENDS the function when the JS engine finishes the return statement line 2) it returns a value from the function
27
What are arrays used for?
to have a collection of data by an ordered list, starting at index 0
28
Describe array literal notation
var = [] empty brackets mean array literal
29
How are arrays different from "plain" objects?
arrays do NOT have a property name and value. They have an index and a value. But like object, the value can be any type aka functions, objects, another array, number, string, etc
30
What number represents the first index of an array?
0
31
What is the length property of an array?
how many items it contains = the length
32
How do you calculate the last index of an array?
by using arrayName.length - 1
33
Why do we log things to the console?
to check our work during development phase
34
What is a method?
a function attached to an object as a property
35
How is a method different from any other function?
you must call it by calling the object first, using dot notation
36
How do you remove the last element from an array?
the pop method
37
How do you round a number down to the nearest integer?
use Math.floor(number here)
38
How do you generate a random number?
Math.random(numbers here) it is only from 0-.999999999999999999999
39
How do you delete an element from an array?
use the splice method, it is the 2nd argument
40
How do you append an element to an array?
by using splice or push
41
How do you break a string up into an array?
the split method
42
Do string methods change the original string? How would you check if you weren't sure?
no they do not, you can console.log the original variable assigned the the original string to check
43
Roughly how many string methods are there according to the MDN Web docs?
40
44
Is the return value of a function or method useful in every situation?
most of the time yes
45
Roughly how many array methods are there according to the MDN Web docs?
about 35
46
What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?
MDN
47
Give 6 examples of comparison operators.
``` < > == === > = < = ```
48
What data type do comparison expressions evaluate to?
boolean so either true or false
49
What is the purpose of an if statement?
to check conditions
50
Is else required in order to use an if statement?
no
51
Describe the syntax (structure) of an if statement.
if ( condition here ) { code here }
52
What are the three logical operators?
&& (and) || (or) ! (not)
53
How do you compare two different expressions in the same condition?
use either && or ||
54
What is the purpose of a loop?
to check values of collection 1 by 1, you can do something during those checks
55
What is the purpose of a condition expression in a loop?
the parameters for when the loop stops/runs
56
What does "iteration" mean in the context of loops?
cycling through each element/value
57
When does the condition expression of a while loop get evaluated?
at the start of the loop
58
When does the initialization expression of a for loop get evaluated?
at the start of the loop
59
When does the condition expression of a for loop get evaluated
after initialization
60
When does the final expression of a for loop get evaluated?
after the condition has ran
61
Besides a return statement, which exits its entire function block, which keyword exits a loop before its condition expression evaluates to false?
break
62
What does the ++ increment operator do?
increases the value of the variable attached by 1
63
How do you iterate through the keys of an object?
by using the for in loop
64
What is a method?
a function inside an obj
65
How can you tell the difference between a method definition and a method call?
definition is when it is being defined inside the function. A method call is requires dot notation to access the method inside the function
66
Describe method definition syntax (structure).
propertyName : function name( parameters) { code block }
67
Describe method call syntax (structure).
objName.Propertyname.methodName( )
68
How is a method different from any other function?
it is part of an object
69
What is the defining characteristic of Object-Oriented Programming?
writing procedural functions and storing them inside objects, which can then be accessed via dot notation
70
What are the four "principles" of Object-Oriented Programming?
Abstraction Encapsulation Inheritance Polymorphism
71
What is "abstraction"?
being able to work with (possibly) complex things in simple ways
72
What does API stand for?
Application Programming Interface
73
What is the purpose of an API?
is a set of functions that allows applications to access data and interact with external software components, operating systems, or microservices