Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- </head>
- <body>
- <script id="jsbin-javascript">
- function TwitterUser (name, handle, email, age) {
- // SET NAME, HANDLE, EMAIL, AND AGE IN THE BLANK SPACE BELOW (Hint: use "this")
- this.name= name;
- this.handle= handle;
- this.email= email;
- this.age= age;
- // do not edit below, creating empty arrays (lists) for followers and tweets
- this.following = [];
- this.tweets = [];
- }
- TwitterUser.prototype.updateName = function (newName) {
- // Directions: set updateName as this objects name, then console.log new name
- this.name= newName;
- console.log(this.name);
- };
- TwitterUser.prototype.updateHandle = function (newHandle) {
- // Directions: set newHandle as this objects handle, then console.log new handle
- this.handle= newHandle;
- console.log(this.handle);
- };
- TwitterUser.prototype.updateEmail = function (newEmail) {
- // Directions: set newEmail as this objects email, then console.log new email
- this.email= newEmail;
- console.log(this.email);
- };
- TwitterUser.prototype.tweet = function (tweetMessage) {
- // Directions: add (push) tweetMessage to the "tweets" array, then alert(tweetMessage)
- this.tweet= tweetMessage;
- this.tweets.push();
- alert(tweetmessage);
- };
- TwitterUser.prototype.followUser = function (anotherTwitterUser) {
- // Directions: add (push) tweetMessage to the "following" array
- this.anotherTwitterUser= anotherTwitterUser;
- this.anotherTwitterUser.push();
- };
- TwitterUser.prototype.showFollowers = function (anotherTwitterUser) {
- // Directions: console.log each individual follower on a new line, by name (Hint: for loop)
- for(){this.anotherTwitterUser= anotherTwitterUser;}
- }
- console.log(this.TwitterUser)
- };
- TwitterUser.prototype.showTweets = function (anotherTwitterUser) {
- // Directions: console.log each individual tweet on a new line, by name (Hint: for loop)
- for(){this.anotherTwitterUser= anotherTwitterUser}
- console.log(this.TwitterUser);
- }
- var maurice = new TwitterUser("Maurice", "@superMaurice", "maurice@gmail.com", 16);
- var maggie = new TwitterUser("Maggie", "@superDuperMaggie", "maggie@gmail.com", 17);
- maurice.updateName("Maurice S.");
- maurice.updateHandle("@superMaurice1000");
- maurice.updateEmail("maurice1000@gmail.com");
- maurice.followUser(maggie);
- maurice.tweet("@superDuperMaggie cool handle!");
- maurice.showFollowers();
- maurice.showTweets();
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">function TwitterUser (name, handle, email, age) {
- // SET NAME, HANDLE, EMAIL, AND AGE IN THE BLANK SPACE BELOW (Hint: use "this")
- this.name= name;
- this.handle= handle;
- this.email= email;
- this.age= age;
- // do not edit below, creating empty arrays (lists) for followers and tweets
- this.following = [];
- this.tweets = [];
- }
- TwitterUser.prototype.updateName = function (newName) {
- // Directions: set updateName as this objects name, then console.log new name
- this.name= newName;
- console.log(this.name);
- };
- TwitterUser.prototype.updateHandle = function (newHandle) {
- // Directions: set newHandle as this objects handle, then console.log new handle
- this.handle= newHandle;
- console.log(this.handle);
- };
- TwitterUser.prototype.updateEmail = function (newEmail) {
- // Directions: set newEmail as this objects email, then console.log new email
- this.email= newEmail;
- console.log(this.email);
- };
- TwitterUser.prototype.tweet = function (tweetMessage) {
- // Directions: add (push) tweetMessage to the "tweets" array, then alert(tweetMessage)
- this.tweet= tweetMessage;
- this.tweets.push();
- alert(tweetmessage);
- };
- TwitterUser.prototype.followUser = function (anotherTwitterUser) {
- // Directions: add (push) tweetMessage to the "following" array
- this.anotherTwitterUser= anotherTwitterUser;
- this.anotherTwitterUser.push();
- };
- TwitterUser.prototype.showFollowers = function (anotherTwitterUser) {
- // Directions: console.log each individual follower on a new line, by name (Hint: for loop)
- for(){this.anotherTwitterUser= anotherTwitterUser;}
- }
- console.log(this.TwitterUser)
- };
- TwitterUser.prototype.showTweets = function (anotherTwitterUser) {
- // Directions: console.log each individual tweet on a new line, by name (Hint: for loop)
- for(){this.anotherTwitterUser= anotherTwitterUser}
- console.log(this.TwitterUser);
- }
- var maurice = new TwitterUser("Maurice", "@superMaurice", "maurice@gmail.com", 16);
- var maggie = new TwitterUser("Maggie", "@superDuperMaggie", "maggie@gmail.com", 17);
- maurice.updateName("Maurice S.");
- maurice.updateHandle("@superMaurice1000");
- maurice.updateEmail("maurice1000@gmail.com");
- maurice.followUser(maggie);
- maurice.tweet("@superDuperMaggie cool handle!");
- maurice.showFollowers();
- maurice.showTweets();</script></body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement