Javascript Flashcards

1
Q

What is a function in JavaScript?

A

process for a set of action that can be repeated

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

Describe the parts of a function definition.

A

function keyword, parenthesis parameter list , curly braces

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

Describe the parts of a function call.

A

function name, parenthesis

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

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

A

presence of code block and a keyword

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

What is the difference between a parameter and an argument?

A

parameter is an empty box and argument are actual values that fill the parameter

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

Why are function parameters useful?

A

differents results with different inputs

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

What two effects does a return statement have on the behavior of a function?

A

give back a value or stop the value

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

Why do we log things to the console?

A

method for developers to write code to inform the developers what the code is doing.

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

What is a method?

A

actions that can be performed on objects

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

How is a method different from any other function?

A

theres a dot

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

How do you remove the last element from an array?

A

Using the Array pop() Method

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

How do you generate a random number?

A

function Math. random()

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

How do you delete an element from an array?

A

Find the index of the array element you want to remove using indexOf , and then remove that index with splice . The splice()

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

How do you append an element to an array?

A

Use the Array.prototype.push method to append values to the end of an array

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

How do you break a string up into an array?

A

String.prototype.split()

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

Do string methods change the original string? How would you check if you weren’t sure?

A

no, i would console.log() to be sure

17
Q

Roughly how many string methods are there according to the MDN Web docs?

A

45

18
Q

Is the return value of a function or method useful in every situation?

A

yes Functions return values. Always

19
Q

Roughly how many array methods are there according to the MDN Web docs?

A

36

20
Q

What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?

A

MDN Web Docs

21
Q

Give 6 examples of comparison operators.

A

== Equal to
!= Not equal to
equal=== Strict equal to
!== Strict not equal to
> Greater than
>= Greater than or equal to
< Less than
<= Less than or equal to

22
Q

What is the purpose of an if statement?

A

executes a block of code if a specified condition is true.

23
Q

What data type do comparison expressions evaluate to?

A

boolean

24
Q

How do you compare two different expressions in the same condition?

A

&&(and). ||(or).