Advertisement
Guest User

Untitled

a guest
Mar 24th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.40 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("Hello, i'm" + this.name);
  32.  
  33.  
  34.  
  35.  
  36. };
  37.  
  38. TwitterUser.prototype.updateHandle = function (newHandle) {
  39. // Directions: set newHandle as this objects handle, then console.log new handle
  40.  
  41. this.handle = newHandle;
  42. console.log("Hello, I'm + this.name");
  43.  
  44. };
  45.  
  46. TwitterUser.prototype.updateEmail = function (newEmail) {
  47. // Directions: set newEmail as this objects email, then console.log new email
  48.  
  49. this.email = newEmail;
  50. console.log("Hello, I'm + this.name");
  51.  
  52.  
  53. };
  54.  
  55. TwitterUser.prototype.tweet = function (tweetMessage) {
  56. // Directions: add (push) tweetMessage to the "tweets" array, then alert(tweetMessage)
  57.  
  58.  
  59. this.tweets.push(tweetMessage);
  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("Hello, i'm" + this.name);
  121.  
  122.  
  123.  
  124.  
  125. };
  126.  
  127. TwitterUser.prototype.updateHandle = function (newHandle) {
  128. // Directions: set newHandle as this objects handle, then console.log new handle
  129.  
  130. this.handle = newHandle;
  131. console.log("Hello, I'm + this.name");
  132.  
  133. };
  134.  
  135. TwitterUser.prototype.updateEmail = function (newEmail) {
  136. // Directions: set newEmail as this objects email, then console.log new email
  137.  
  138. this.email = newEmail;
  139. console.log("Hello, I'm + this.name");
  140.  
  141.  
  142. };
  143.  
  144. TwitterUser.prototype.tweet = function (tweetMessage) {
  145. // Directions: add (push) tweetMessage to the "tweets" array, then alert(tweetMessage)
  146.  
  147.  
  148. this.tweets.push(tweetMessage);
  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