Javascript Flashcards
What is a function in JavaScript?
process for a set of action that can be repeated
Describe the parts of a function definition.
function keyword, parenthesis parameter list , curly braces
Describe the parts of a function call.
function name, parenthesis
When comparing them side-by-side, what are the differences between a function call and a function definition?
presence of code block and a keyword
What is the difference between a parameter and an argument?
parameter is an empty box and argument are actual values that fill the parameter
Why are function parameters useful?
differents results with different inputs
What two effects does a return statement have on the behavior of a function?
give back a value or stop the value
Why do we log things to the console?
method for developers to write code to inform the developers what the code is doing.
What is a method?
actions that can be performed on objects
How is a method different from any other function?
theres a dot
How do you remove the last element from an array?
Using the Array pop() Method
How do you generate a random number?
function Math. random()
How do you delete an element from an array?
Find the index of the array element you want to remove using indexOf , and then remove that index with splice . The splice()
How do you append an element to an array?
Use the Array.prototype.push method to append values to the end of an array
How do you break a string up into an array?
String.prototype.split()