Guest User

Untitled

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