Advertisement
Guest User

Untitled

a guest
Mar 24th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.16 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>JS Bin</title>
  7. </head>
  8. <body>
  9.  
  10. <script id="jsbin-javascript">
  11. function TwitterUser (name, handle, email, age) {
  12. // SET NAME, HANDLE, EMAIL, AND AGE IN THE BLANK SPACE BELOW (Hint: use "this")
  13. this.name = name;
  14. this.handle=handle;
  15. this.email=email;
  16. this.age=age;
  17.  
  18.  
  19.  
  20.  
  21. // do not edit below, creating empty arrays (lists) for followers and tweets
  22. this.following = [];
  23. this.tweets = [];
  24. }
  25.  
  26. TwitterUser.prototype.updateName = function (newName) {
  27. // Directions: set newName, then console.log new name
  28. this.name=newName;
  29. console.log(newName);
  30.  
  31.  
  32.  
  33.  
  34. };
  35.  
  36. TwitterUser.prototype.updateHandle = function (newHandle) {
  37. // Directions: set newHandle as this objects handle, then console.log new handle
  38. this.handle=newHandle;
  39. console.log(newHandle);
  40.  
  41. };
  42.  
  43. TwitterUser.prototype.updateEmail = function (newEmail) {
  44. // Directions: set newEmail as this objects email, then console.log new email
  45.  
  46.  
  47.  
  48. };
  49.  
  50. TwitterUser.prototype.tweet = function (tweetMessage) {
  51. // Directions: add (push) tweetMessage to the "tweets" array, then alert(tweetMessage)
  52. TwitterUser.prototype.tweet.push("tweetMessage")
  53.  
  54.  
  55. };
  56.  
  57. TwitterUser.prototype.followUser = function (anotherTwitterUser) {
  58. // Directions: add (push) tweetMessage to the "following" array
  59.  
  60.  
  61.  
  62. };
  63.  
  64. TwitterUser.prototype.showFollowers = function (anotherTwitterUser) {
  65. // Directions: console.log each individual follower on a new line, by name (Hint: for loop)
  66.  
  67.  
  68.  
  69. };
  70.  
  71. TwitterUser.prototype.showTweets = function (anotherTwitterUser) {
  72. // Directions: console.log each individual tweet on a new line, by name (Hint: for loop)
  73.  
  74.  
  75.  
  76. };
  77.  
  78.  
  79. var maurice = new TwitterUser("Maurice", "@superMaurice", "maurice@gmail.com", 16);
  80. var maggie = new TwitterUser("Maggie", "@superDuperMaggie", "maggie@gmail.com", 17);
  81.  
  82. maurice.updateName("Maurice S.");
  83. maurice.updateHandle("@superMaurice1000");
  84. maurice.updateEmail("maurice1000@gmail.com");
  85.  
  86. maurice.followUser(maggie);
  87. maurice.tweet("@superDuperMaggie cool handle!");
  88.  
  89. maurice.showFollowers();
  90. maurice.showTweets();
  91. </script>
  92.  
  93.  
  94.  
  95. <script id="jsbin-source-javascript" type="text/javascript">function TwitterUser (name, handle, email, age) {
  96. // SET NAME, HANDLE, EMAIL, AND AGE IN THE BLANK SPACE BELOW (Hint: use "this")
  97. this.name = name;
  98. this.handle=handle;
  99. this.email=email;
  100. this.age=age;
  101.  
  102.  
  103.  
  104.  
  105. // do not edit below, creating empty arrays (lists) for followers and tweets
  106. this.following = [];
  107. this.tweets = [];
  108. }
  109.  
  110. TwitterUser.prototype.updateName = function (newName) {
  111. // Directions: set newName, then console.log new name
  112. this.name=newName;
  113. console.log(newName);
  114.  
  115.  
  116.  
  117.  
  118. };
  119.  
  120. TwitterUser.prototype.updateHandle = function (newHandle) {
  121. // Directions: set newHandle as this objects handle, then console.log new handle
  122. this.handle=newHandle;
  123. console.log(newHandle);
  124.  
  125. };
  126.  
  127. TwitterUser.prototype.updateEmail = function (newEmail) {
  128. // Directions: set newEmail as this objects email, then console.log new email
  129.  
  130.  
  131.  
  132. };
  133.  
  134. TwitterUser.prototype.tweet = function (tweetMessage) {
  135. // Directions: add (push) tweetMessage to the "tweets" array, then alert(tweetMessage)
  136. TwitterUser.prototype.tweet.push("tweetMessage")
  137.  
  138.  
  139. };
  140.  
  141. TwitterUser.prototype.followUser = function (anotherTwitterUser) {
  142. // Directions: add (push) tweetMessage to the "following" array
  143.  
  144.  
  145.  
  146. };
  147.  
  148. TwitterUser.prototype.showFollowers = function (anotherTwitterUser) {
  149. // Directions: console.log each individual follower on a new line, by name (Hint: for loop)
  150.  
  151.  
  152.  
  153. };
  154.  
  155. TwitterUser.prototype.showTweets = function (anotherTwitterUser) {
  156. // Directions: console.log each individual tweet on a new line, by name (Hint: for loop)
  157.  
  158.  
  159.  
  160. };
  161.  
  162.  
  163. var maurice = new TwitterUser("Maurice", "@superMaurice", "maurice@gmail.com", 16);
  164. var maggie = new TwitterUser("Maggie", "@superDuperMaggie", "maggie@gmail.com", 17);
  165.  
  166. maurice.updateName("Maurice S.");
  167. maurice.updateHandle("@superMaurice1000");
  168. maurice.updateEmail("maurice1000@gmail.com");
  169.  
  170. maurice.followUser(maggie);
  171. maurice.tweet("@superDuperMaggie cool handle!");
  172.  
  173. maurice.showFollowers();
  174. maurice.showTweets();</script></body>
  175. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement