- Define what an abstractions is
- Explain why abstractions are useful
- Define what a function is and why they are useful
- Describe why functions are abstractions
- Explain the syntax of functions
- Function Declaration
- Function Expression
- Anonymous Function
- Paramater
- Argument
- Invoke
-
What are abstractions? With your table, create a definition of what an abstraction is. Also, describe one abstraction that you have worked with.
Your answer...
-
Why are abstraction useful? With your table, synthesize an explanation of why abstractions are useful. Add an example of when an abstraction helped you be more productive.
Your answer...
-
Define what a function is and why they are useful.
Your answer...
-
Why are functions abstractions?
Your answer...
-
Explain the syntax of a function.
Label the following code with all the function termanology that you know!
1) keyword 2) name 3) body 4) parameters 5) arguments 6) invokation
function sayHi(name) { return `Hello, ${name}` } sayHi('Mossy')
Your answer...
-
How are function declarations different from function expressions?
Your answer...
-
What is the difference between these two functions?
function boom () { console.log('BOOM!') } function boom () { return 'BOOM!' }
Your answer...
In a scratch javascript file write the code for the following functions. Compare your work with your neighbor.
-
Update the following code to use a function.
var names = [ 'Erik', 'Sarah', 'Nancy', 'Matt' ] if (names.length > 0) { var selected = names.shift() console.log(selected) } if (names.length > 0) { var selected = names.shift() console.log(selected) } if (names.length > 0) { var selected = names.shift() console.log(selected) }
Your answer...
-
Write a function called
printNums
that prints out the numbers 0 through 9.Your answer...
-
Update your
printNums
function to take anum
paramater, then update your code to only print the numbers 0 throughnum
.Your answer...
-
Update your
printNums
function to take 2 paramaters. The first paramater is the starting number and second will be the ending number (inclusive).Your answer...
-
Write a function named
sumAll
that will take 0 or more arguments, and return the sum of all arguments. Hint: lookup thearguments
keyword.Your answer...
-
Write a function called
times2
, that takes a number as input and returns this number multiplied by 2.Your answer...
-
What would the result of the following code be?
times2(times2(3))
Your answer...
-
Looking at the code bellow, what order will we see the the logs?
function boom() { console.log('BOOM!') } function bang() { console.log('BANG!') } function pow() { console.log('POW!') } boom(bang(pow()))
Your answer...