In this project, you will create an object in JavaScript that represents your favorite movie. You will also add methods to the object and modify its properties to reflect your favorite movie.
- Fork and clone this repository to your local machine.
- Navigate to the project folder.
- Open the object.js file and start working on your object.
- Test your object in the console to make sure it works as expected.
- Choose your favorite movie.
- Create a JavaScript object that represents a movie with the following properties:
title(a string)year(a number)director(a string)actors(a string)rating(a number)timesWatched(a number, representing the number of times you have watched the movie)
- The movie object should also have the following methods:
recommend(): Prints a message recommending the movie to a friend.watch(): This method increments thetimesWatchedproperty by 1, representing that the movie has been watched one more time.setRating(newRating): This method takes a new rating as an argument and updates theratingproperty of the movie object with the new value.addActor(actorName): This method takes an actor's name as an argument and appends it to theactorsproperty, which represents the list of actors in the movie.isPopular(): This method returns a boolean value indicating whether the movie is popular or not, based on its rating (popular > 8).summary(): Prints a paragraph summarizing the movie's information, including the title, year, director, actors, and rating.
- Create a copy of the object. (Hint: You can use the spread operator (...) or the Object.assign() method)
- Modify the properties of the new object to represent another favorite movie.
- Add a new property called myRating and include your rating of the movie.
- Test the object's methods and properties in the console to ensure they function as expected.
After completing the tasks, please follow the instructions below to submit your work:
- Run git add . in your terminal to track the changes
- Run git commit -m "" to stage the changes
- Run git push to push the changes to your forked repository
- Create a pull request to submit your work for review
Here are some resources that may be helpful for completing this project:
And.. Don't forget to enjoy the journey!😉