Advertisement
Guest User

Untitled

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