WorksheetsFunctions and Objects
Total questions: 10
Worksheet time: 6mins
What type of function is this?
Function Expression
Function Declaration
Arrow Function
Not a function
Why do we write functions?
To make our code more reusable
To make our code easier to understand
To avoid repeating our code
All of these
What type of function is this?
Function Expression
Function Declaration
Arrow Function
Not a function
Why do we use parameters in functions?
To create a lot of functions
To make is easier for the user to input values when playing a game.
To be able to go back and fix error in the code and make it easier to debug.
Parameters allow a function to perform tasks without knowing the specific input values ahead of time.
What type of function is this?
Arrow Function
Function Declaration
Not a function
Function Expression
Which one of these is the correct way to store an object in a variable?
let person = {age=31, hair='brown'};
let person = {age: 31, hair: 'brown'};
let person = {age:31 hair:'brown'};
let person = {let age=31, lethair='brown'};
Which of these objects have 3 properties?
let person = {age: 31, hair: 'brown'};
let person = {age: 31};
let person = {age: 31, hair: 'brown', eyes: 'blue'};
let person = {hair: ['brown', 'blonde', 'pink']};
We're storing an object in a variable named 'cafe' with the property 'drinks'. Which line of code would change that property's value?
cafe[drink] = 'coffee';
cafe.drink = 'coffee';
cafe_drink = 'coffee';
let cafel.drink = 'coffee';
Which of these is a valid line of JavaScript that stores an array of objects in a variable?
let films = [{title: 'Die Hard', actor: 'Bruce Willis'}];
let films = [{title='Die Hard', actor='Bruce Willis'}];
let films = {[title: 'Die Hard', actor: 'Bruce Willis']};
let films = [title: 'Die Hard', actor: 'Bruce Willis'];
What is the output of this function?
9
10
11
12
