Advertisement
Guest User

Untitled

a guest
Oct 7th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 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. // Write your code below this line
  12.  
  13. var contacts = [
  14. {firstName: "John",
  15. lastName: "Doe",
  16. phone: "(512) 355-0453",
  17. email: "johndoe@email.com"},
  18.  
  19. {firstName: "Jane",
  20. lastName: "Doe",
  21. phone: "(312) 641-2203",
  22. email: "janedoe@email.com"
  23. },
  24.  
  25. {firstName: "Suzie",
  26. lastName: "Smith",
  27. phone: "(415) 604-4219",
  28. email: "suziesmith@email.com"
  29. }]
  30.  
  31.  
  32. var listcontacts = function(){
  33. for(var i = 0; i < contacts.length; i++){
  34. var firstName = contacts[i].firstName;
  35. var lastName = contacts[i].lastName;
  36. console.log(firstName + " " + lastName);
  37. }
  38. }
  39.  
  40. listcontacts();
  41. </script>
  42.  
  43.  
  44.  
  45. <script id="jsbin-source-javascript" type="text/javascript">// Write your code below this line
  46.  
  47. var contacts = [
  48. {firstName: "John",
  49. lastName: "Doe",
  50. phone: "(512) 355-0453",
  51. email: "johndoe@email.com"},
  52.  
  53. {firstName: "Jane",
  54. lastName: "Doe",
  55. phone: "(312) 641-2203",
  56. email: "janedoe@email.com"
  57. },
  58.  
  59. {firstName: "Suzie",
  60. lastName: "Smith",
  61. phone: "(415) 604-4219",
  62. email: "suziesmith@email.com"
  63. }]
  64.  
  65.  
  66. var listcontacts = function(){
  67. for(var i = 0; i < contacts.length; i++){
  68. var firstName = contacts[i].firstName;
  69. var lastName = contacts[i].lastName;
  70. console.log(firstName + " " + lastName);
  71. }
  72. }
  73.  
  74. listcontacts();
  75.  
  76. </script></body>
  77. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement