This quiz is meant to evaluate your knowledge of JavaScript
- Types
- Conditionals
- Loops
- Variables and Constants
- Functions
- and Operators
Moreover, is an example of what you may be expected to code later in the course and out in life.
Please answer all of the question in Questions and implement everything in Code. An object, obj
, is defined for you. All questions and coding problems must make use of that object.
If you finish those early, please move on to the Bonus and Challenge sections. These are meant to test your ability to solve basic problems using all the things you have learned along with a few things you may not have learned.
You have 10 mins to complete...
var obj = {
movies: [
'The Lion King',
'Aladdin',
'The Little Mermaid',
'The Fox and the Hound',
'Beauty and the Beast',
'Mulan',
'Pinocchio',
'Cinderelle',
'The Princess and the Frog',
'Pocahontas',
],
reviews: [
function(movie) {
return movie + ' is extremely funny!'
},
function(movie) {
return movie + ' is the best movie of all time!'
},
function(movie1, movie2) {
return movie1 + ' came out before ' + movie2 + '.'
},
],
favorites: [
{
'is CGI': [
{
frozen: {
'Main Characters': [
'Elsa',
'Anna',
'Olaf',
'Kristoff',
'Hans',
'Pabbie',
'Duke of Weselton',
],
songs: [
{
title: 'For the First Time in Forever',
length: '3:45',
},
{
title: 'Let it Go',
length: '3:45',
},
{
title: 'Do You Want to Build a Snowman',
length: '2:37',
},
],
},
},
],
},
],
studio: 'Disney',
animatedFeatures: 56,
isMovieTitleLonger: function(movie1, movie2) {
return movie1.length > movie2.length
},
releases: {
'70s': [
'The Aristocats',
'Robin Hood',
'The Many Adventures of Winnie the Poo',
'The Rescuers',
],
'80s': 6,
'90s': 18,
'2000s': 24,
},
compareMovies: function(movie1) {
return function(movie) {
const review = obj.reviews[obj.reviews.length + -1 * obj.reviews.length](movie1)
return review + ' but ' + obj.reviews[obj.reviews.length - 1](movie1, movie)
}
},
}
- What does
compareMovies
return? - What type is
songs
?
- Write the statement that returns the number of releases for the 90s.
- Write the statement that returns
"Pocahontas came out before The Princess and the Frog"
; kudos for using a function
- Write a function,
frozenCharactersWithTwoOrMoreVowelsInName
, that prints all the characters in Frozen whose name contains 2 vowels or more - Write a function,
countCharacters
, that returns the character count of all movie titles - Write a function,
longestMovieTitle
, that returns the longest movie title; use theisMovieTitleLonger
key/property
- Write a function,
lengthOfFrozenSongsInSeconds
, that returns the length of all the songs in Frozen in seconds - write a function,
mostProductiveYear
, that returns the most productive year for releases; productive is defined by amount of movies released
Answers to Questions and solutions to Code will be reviewed after the quiz.