Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
51 changes: 0 additions & 51 deletions README.md

This file was deleted.

6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Object</title>
<script src="app.js"></script>
</head>

<body>
<script src="./object.js" />

</body>

</html>
60 changes: 60 additions & 0 deletions object.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
let movie = {

title: "mulan",
year: 1999,
director: "tony",
actor: "barry",
rating: 8,
timesWatched: 15,


recommend: function () {
console.log(
`${this.title} is movie is amazing`);

},
watch() {

this.timesWatched = this.timesWatched + 1
},
rating(newValue) {

this.rating = newValue
console.log(this.rating)
},
addactor(newactor) {

this.actor = newactor

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of this function is to add a new actor to the actors list. However, what you did will replace the whole actors list with the new one. You can use either the concat method or the plus sign:
this.actors = this.actors.concat(", ", actorName);
this.actors = this.actors + ", " + actorName;

console.log(this.actor)


},




}

let anothermovie=(...movie);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect syntax:
let anothermovie={...movie};



anothermovie.title= "friends"
anothermovie. year=1989,
anothermovie.director= "david",
anothermovie.actor="jennifer",
anothermovie.rating= 9,
anothermovie.timesWatched=5,







console.log(movie.recommend());

movie.sayhello();

console.log(anothermovie);
anothermovie.myrating=9
console.log(anothermovie.myrating)