Objects Problem Set
movieDB
Create an array of movie objects. Each movie should have a title, rating, and hasWatched properties. Iterate through the array and print out something that looks like:
You have watched "In Bruges" - 5 stars
You have not seen "Frozen" - 4.5 stars
You have seen "Mad Max Fury Road" - 5 stars
You have not seen "Les Miserables" - 3.5 stars
USE YOUR OWN MOVIES!
prettyPrint()
Write a function prettyPrint() that accepts an object as an argument and prints out a "pretty" string version of the object.
prettyPrint({name: "Rusty", species: "dog", breed: "mutt"});
//the above code should print the following 3 lines:
//name: Rusty
//species: dog
//breed: mutt
charCount()
Write a function charCount() that takes a string argument and returns an object listing the character frequency of the string.
charCount("hello");
// {
// "h": 1,
// "e": 1,
// "l": 2,
// "o": 1
// }
//It should ignore capitalization
charCount("AaBbC")
// {
// "a": 2,
// "b": 2,
// "c": 1,
// }
BONUS: mostFreqChar()
Write a function mostFreqChar() that takes a string argument and returns the character that appears most often in the string
charCount("HELLO"); //=> "L"
charCount("abbbcc"); //=>"b"
charCount("www.dog.com"); //=> "w"
Printer Friendly - Objects Problem Set
By Colt Steele
Printer Friendly - Objects Problem Set
- 1,657