Advertisement
Guest User

Untitled

a guest
Jan 8th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JS Bin</title>
  6. </head>
  7. <body>
  8. <h1>Joe Bliss</h1>
  9. <script id="jsbin-javascript">
  10. var contacts = [
  11. { 'firstName': 'John'
  12. 'lastName' : 'Doe'
  13. 'phone' : '(512) 355-0453'
  14. 'email' : 'johndoe@email.com'
  15. },
  16. { 'firstName': 'Jane'
  17. 'lastName' : 'Doe'
  18. 'phone' : '(312) 641-2203'
  19. 'email' : 'janedoe@email.com'
  20. },
  21. { 'firstName': 'Suzie'
  22. 'lastName' : 'Smith'
  23. 'phone' : '(415) 604-4219'
  24. 'email' : 'suziesmith@email.com'
  25. }
  26. ];
  27.  
  28. var addContact = function(newContact) {
  29. contacts.push(newContact);
  30. return contacts
  31. };
  32.  
  33. addContact( {'firstName': 'John'
  34. 'lastName' : 'Doe'
  35. 'phone' : '(512) 355-0453'
  36. 'email' : 'johndoe@email.com'});
  37.  
  38. var listContact = function(contacts){
  39. for(var i = 0; i < contacts.length; i++){
  40. console.log('firstName');
  41. console.log('lastName');
  42. }
  43. }
  44.  
  45. var search = function(name){
  46. for(var i = 0; i <= contatcs.length; i++){
  47. if('firstName' && 'lastName' == name){
  48. return name
  49. }
  50. }
  51. }
  52.  
  53. console.log('contacts');
  54. listContact();
  55. </script>
  56.  
  57.  
  58.  
  59. <script id="jsbin-source-javascript" type="text/javascript">var contacts = [
  60. { 'firstName': 'John'
  61. 'lastName' : 'Doe'
  62. 'phone' : '(512) 355-0453'
  63. 'email' : 'johndoe@email.com'
  64. },
  65. { 'firstName': 'Jane'
  66. 'lastName' : 'Doe'
  67. 'phone' : '(312) 641-2203'
  68. 'email' : 'janedoe@email.com'
  69. },
  70. { 'firstName': 'Suzie'
  71. 'lastName' : 'Smith'
  72. 'phone' : '(415) 604-4219'
  73. 'email' : 'suziesmith@email.com'
  74. }
  75. ];
  76.  
  77. var addContact = function(newContact) {
  78. contacts.push(newContact);
  79. return contacts
  80. };
  81.  
  82. addContact( {'firstName': 'John'
  83. 'lastName' : 'Doe'
  84. 'phone' : '(512) 355-0453'
  85. 'email' : 'johndoe@email.com'});
  86.  
  87. var listContact = function(contacts){
  88. for(var i = 0; i < contacts.length; i++){
  89. console.log('firstName');
  90. console.log('lastName');
  91. }
  92. }
  93.  
  94. var search = function(name){
  95. for(var i = 0; i <= contatcs.length; i++){
  96. if('firstName' && 'lastName' == name){
  97. return name
  98. }
  99. }
  100. }
  101.  
  102. console.log('contacts');
  103. listContact();</script></body>
  104. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement