We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>JavaScript</title> </head> <body> <section> <div> <img src="" alt="" id="post-1" height="200" /> </div> </section> <section> <div> <img id="post-1-heart" src="" alt="Like" height="10" /> <span id="post-1-likes"></span> <span id="post-1-likes-text"></span> </div> </section> <script src="index.js"></script> </body> </html>
class InstagramPost { constructor(imageUrl) { this.imageUrl = imageUrl; this.likes = []; } likedByUser(id) { this.likes.push(id); } getLikes() { return this.likes; } render() { document.getElementById("post-1").setAttribute("src", this.imageUrl); } renderLikes() { document.getElementById("post-1-likes").innerHTML = this.likes.length > 0 ? this.likes.length : 0; document.getElementById("post-1-likes-text").innerHTML = this.likes.length > 0 ? "likes" : "like"; document .getElementById("post-1-heart") .setAttribute( "src", this.likes.length > 0 ? "./images/red-heart.png" : "./images/black-heart.png" ); } } const instagramPost = new InstagramPost("./images/plus-size-woman.jpg"); instagramPost.render(); instagramPost.renderLikes(); let postImage = document.getElementById("post-1") postImage.addEventListener('dblclick', () => { instagramPost.likedByUser(1); instagramPost.renderLikes(); })
Sorry, something went wrong.
repo (attempted challenge through reference but the result was poopOOPeepee)
https://github.com/thomasfebrianseiei/project-oop
anbya
idhoramgg
mevinyanuar
jantoandriano
thomasfebrianseiei
gunturbudi16
GalangHarindito
nicohusin
thatguyarsya
afriansyahian
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: