Advertisement
Guest User

Untitled

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