Guest User

Untitled

a guest
Nov 26th, 2018
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.55 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. var myDb= [
  12. {
  13. "id": 1,
  14. "name": "Leanne Graham",
  15. "username": "Bret",
  16. "email": "Sincere@april.biz",
  17. "address": {
  18. "street": "Kulas Light",
  19. "suite": "Apt. 556",
  20. "city": "Gwenborough",
  21. "zipcode": "92998-3874",
  22. "geo": {
  23. "lat": "-37.3159",
  24. "lng": "81.1496"
  25. }
  26. },
  27. "phone": "1-770-736-8031 x56442",
  28. "website": "hildegard.org",
  29. "company": {
  30. "name": "Romaguera-Crona",
  31. "catchPhrase": "Multi-layered client-server neural-net",
  32. "bs": "harness real-time e-markets"
  33. }
  34. },
  35. {
  36. "id": 2,
  37. "name": "Ervin Howell",
  38. "username": "Antonette",
  39. "email": "Shanna@melissa.tv",
  40. "address": {
  41. "street": "Victor Plains",
  42. "suite": "Suite 879",
  43. "city": "Wisokyburgh",
  44. "zipcode": "90566-7771",
  45. "geo": {
  46. "lat": "-43.9509",
  47. "lng": "-34.4618"
  48. }
  49. },
  50. "phone": "010-692-6593 x09125",
  51. "website": "anastasia.net",
  52. "company": {
  53. "name": "Deckow-Crist",
  54. "catchPhrase": "Proactive didactic contingency",
  55. "bs": "synergize scalable supply-chains"
  56. }
  57. },
  58. {
  59. "id": 3,
  60. "name": "Clementine Bauch",
  61. "username": "Samantha",
  62. "email": "Nathan@yesenia.net",
  63. "address": {
  64. "street": "Douglas Extension",
  65. "suite": "Suite 847",
  66. "city": "McKenziehaven",
  67. "zipcode": "59590-4157",
  68. "geo": {
  69. "lat": "-68.6102",
  70. "lng": "-47.0653"
  71. }
  72. },
  73. "phone": "1-463-123-4447",
  74. "website": "ramiro.info",
  75. "company": {
  76. "name": "Romaguera-Jacobson",
  77. "catchPhrase": "Face to face bifurcated interface",
  78. "bs": "e-enable strategic applications"
  79. }
  80. },
  81. {
  82. "id": 4,
  83. "name": "Patricia Lebsack",
  84. "username": "Karianne",
  85. "email": "Julianne.OConner@kory.org",
  86. "address": {
  87. "street": "Hoeger Mall",
  88. "suite": "Apt. 692",
  89. "city": "South Elvis",
  90. "zipcode": "53919-4257",
  91. "geo": {
  92. "lat": "29.4572",
  93. "lng": "-164.2990"
  94. }
  95. },
  96. "phone": "493-170-9623 x156",
  97. "website": "kale.biz",
  98. "company": {
  99. "name": "Robel-Corkery",
  100. "catchPhrase": "Multi-tiered zero tolerance productivity",
  101. "bs": "transition cutting-edge web services"
  102. }
  103. },
  104. {
  105. "id": 5,
  106. "name": "Chelsey Dietrich",
  107. "username": "Kamren",
  108. "email": "Lucio_Hettinger@annie.ca",
  109. "address": {
  110. "street": "Skiles Walks",
  111. "suite": "Suite 351",
  112. "city": "Roscoeview",
  113. "zipcode": "33263",
  114. "geo": {
  115. "lat": "-31.8129",
  116. "lng": "62.5342"
  117. }
  118. },
  119. "phone": "(254)954-1289",
  120. "website": "demarco.info",
  121. "company": {
  122. "name": "Keebler LLC",
  123. "catchPhrase": "User-centric fault-tolerant solution",
  124. "bs": "revolutionize end-to-end systems"
  125. }
  126. },
  127. {
  128. "id": 6,
  129. "name": "Mrs. Dennis Schulist",
  130. "username": "Leopoldo_Corkery",
  131. "email": "Karley_Dach@jasper.info",
  132. "address": {
  133. "street": "Norberto Crossing",
  134. "suite": "Apt. 950",
  135. "city": "South Christy",
  136. "zipcode": "23505-1337",
  137. "geo": {
  138. "lat": "-71.4197",
  139. "lng": "71.7478"
  140. }
  141. },
  142. "phone": "1-477-935-8478 x6430",
  143. "website": "ola.org",
  144. "company": {
  145. "name": "Considine-Lockman",
  146. "catchPhrase": "Synchronised bottom-line interface",
  147. "bs": "e-enable innovative applications"
  148. }
  149. },
  150. {
  151. "id": 7,
  152. "name": "Kurtis Weissnat",
  153. "username": "Elwyn.Skiles",
  154. "email": "Telly.Hoeger@billy.biz",
  155. "address": {
  156. "street": "Rex Trail",
  157. "suite": "Suite 280",
  158. "city": "Howemouth",
  159. "zipcode": "58804-1099",
  160. "geo": {
  161. "lat": "24.8918",
  162. "lng": "21.8984"
  163. }
  164. },
  165. "phone": "210.067.6132",
  166. "website": "elvis.io",
  167. "company": {
  168. "name": "Johns Group",
  169. "catchPhrase": "Configurable multimedia task-force",
  170. "bs": "generate enterprise e-tailers"
  171. }
  172. },
  173. {
  174. "id": 8,
  175. "name": "Nicholas Runolfsdottir V",
  176. "username": "Maxime_Nienow",
  177. "email": "Sherwood@rosamond.me",
  178. "address": {
  179. "street": "Ellsworth Summit",
  180. "suite": "Suite 729",
  181. "city": "Aliyaview",
  182. "zipcode": "45169",
  183. "geo": {
  184. "lat": "-14.3990",
  185. "lng": "-120.7677"
  186. }
  187. },
  188. "phone": "586.493.6943 x140",
  189. "website": "jacynthe.com",
  190. "company": {
  191. "name": "Abernathy Group",
  192. "catchPhrase": "Implemented secondary concept",
  193. "bs": "e-enable extensible e-tailers"
  194. }
  195. },
  196. {
  197. "id": 9,
  198. "name": "Glenna Reichert",
  199. "username": "Delphine",
  200. "email": "Chaim_McDermott@dana.io",
  201. "address": {
  202. "street": "Dayna Park",
  203. "suite": "Suite 449",
  204. "city": "Bartholomebury",
  205. "zipcode": "76495-3109",
  206. "geo": {
  207. "lat": "24.6463",
  208. "lng": "-168.8889"
  209. }
  210. },
  211. "phone": "(775)976-6794 x41206",
  212. "website": "conrad.com",
  213. "company": {
  214. "name": "Yost and Sons",
  215. "catchPhrase": "Switchable contextually-based project",
  216. "bs": "aggregate real-time technologies"
  217. }
  218. },
  219. {
  220. "id": 10,
  221. "name": "Clementina DuBuque",
  222. "username": "Moriah.Stanton",
  223. "email": "Rey.Padberg@karina.biz",
  224. "address": {
  225. "street": "Kattie Turnpike",
  226. "suite": "Suite 198",
  227. "city": "Lebsackbury",
  228. "zipcode": "31428-2261",
  229. "geo": {
  230. "lat": "-38.2386",
  231. "lng": "57.2232"
  232. }
  233. },
  234.  
  235. "phone": "024-648-3804",
  236. "website": "ambrose.net",
  237. "company": {
  238. "name": "Hoeger LLC",
  239. "catchPhrase": "Centralized empowering task-force",
  240. "bs": "target end-to-end models"
  241. }
  242.  
  243. }
  244.  
  245.  
  246.  
  247.  
  248. ];
  249.  
  250.  
  251. console.log("Part 1");
  252. for(var i = 0; i < myDb.length;i++){
  253. console.log(myDb[i].name);
  254. }
  255.  
  256. console.log("Part 2");
  257. for(var i = 0; i<myDb.length;i++){
  258. console.log("lat:" + myDb[i].address.geo.lat + " long: " + myDb[i].address.geo.lng);
  259. }
  260.  
  261. console.log("Part 3");
  262. for(var i = 0; i<myDb.length;i++){
  263. console.log("name: " + myDb[i].name + " id: " + myDb[i].id + " company name: " + myDb[i].company.name + " zipcode: " + myDb[i].address.zipcode);
  264. }
  265.  
  266. console.log("Part 4")
  267. for(var i = 0; i<myDb.length;i++){
  268. if(myDb[i].address.zipcode[0] == 5){
  269. console.log("zipcodes: " + myDb[i].address.zipcode);
  270.  
  271. }
  272. }
  273. </script>
  274.  
  275.  
  276.  
  277. <script id="jsbin-source-javascript" type="text/javascript">var myDb= [
  278. {
  279. "id": 1,
  280. "name": "Leanne Graham",
  281. "username": "Bret",
  282. "email": "Sincere@april.biz",
  283. "address": {
  284. "street": "Kulas Light",
  285. "suite": "Apt. 556",
  286. "city": "Gwenborough",
  287. "zipcode": "92998-3874",
  288. "geo": {
  289. "lat": "-37.3159",
  290. "lng": "81.1496"
  291. }
  292. },
  293. "phone": "1-770-736-8031 x56442",
  294. "website": "hildegard.org",
  295. "company": {
  296. "name": "Romaguera-Crona",
  297. "catchPhrase": "Multi-layered client-server neural-net",
  298. "bs": "harness real-time e-markets"
  299. }
  300. },
  301. {
  302. "id": 2,
  303. "name": "Ervin Howell",
  304. "username": "Antonette",
  305. "email": "Shanna@melissa.tv",
  306. "address": {
  307. "street": "Victor Plains",
  308. "suite": "Suite 879",
  309. "city": "Wisokyburgh",
  310. "zipcode": "90566-7771",
  311. "geo": {
  312. "lat": "-43.9509",
  313. "lng": "-34.4618"
  314. }
  315. },
  316. "phone": "010-692-6593 x09125",
  317. "website": "anastasia.net",
  318. "company": {
  319. "name": "Deckow-Crist",
  320. "catchPhrase": "Proactive didactic contingency",
  321. "bs": "synergize scalable supply-chains"
  322. }
  323. },
  324. {
  325. "id": 3,
  326. "name": "Clementine Bauch",
  327. "username": "Samantha",
  328. "email": "Nathan@yesenia.net",
  329. "address": {
  330. "street": "Douglas Extension",
  331. "suite": "Suite 847",
  332. "city": "McKenziehaven",
  333. "zipcode": "59590-4157",
  334. "geo": {
  335. "lat": "-68.6102",
  336. "lng": "-47.0653"
  337. }
  338. },
  339. "phone": "1-463-123-4447",
  340. "website": "ramiro.info",
  341. "company": {
  342. "name": "Romaguera-Jacobson",
  343. "catchPhrase": "Face to face bifurcated interface",
  344. "bs": "e-enable strategic applications"
  345. }
  346. },
  347. {
  348. "id": 4,
  349. "name": "Patricia Lebsack",
  350. "username": "Karianne",
  351. "email": "Julianne.OConner@kory.org",
  352. "address": {
  353. "street": "Hoeger Mall",
  354. "suite": "Apt. 692",
  355. "city": "South Elvis",
  356. "zipcode": "53919-4257",
  357. "geo": {
  358. "lat": "29.4572",
  359. "lng": "-164.2990"
  360. }
  361. },
  362. "phone": "493-170-9623 x156",
  363. "website": "kale.biz",
  364. "company": {
  365. "name": "Robel-Corkery",
  366. "catchPhrase": "Multi-tiered zero tolerance productivity",
  367. "bs": "transition cutting-edge web services"
  368. }
  369. },
  370. {
  371. "id": 5,
  372. "name": "Chelsey Dietrich",
  373. "username": "Kamren",
  374. "email": "Lucio_Hettinger@annie.ca",
  375. "address": {
  376. "street": "Skiles Walks",
  377. "suite": "Suite 351",
  378. "city": "Roscoeview",
  379. "zipcode": "33263",
  380. "geo": {
  381. "lat": "-31.8129",
  382. "lng": "62.5342"
  383. }
  384. },
  385. "phone": "(254)954-1289",
  386. "website": "demarco.info",
  387. "company": {
  388. "name": "Keebler LLC",
  389. "catchPhrase": "User-centric fault-tolerant solution",
  390. "bs": "revolutionize end-to-end systems"
  391. }
  392. },
  393. {
  394. "id": 6,
  395. "name": "Mrs. Dennis Schulist",
  396. "username": "Leopoldo_Corkery",
  397. "email": "Karley_Dach@jasper.info",
  398. "address": {
  399. "street": "Norberto Crossing",
  400. "suite": "Apt. 950",
  401. "city": "South Christy",
  402. "zipcode": "23505-1337",
  403. "geo": {
  404. "lat": "-71.4197",
  405. "lng": "71.7478"
  406. }
  407. },
  408. "phone": "1-477-935-8478 x6430",
  409. "website": "ola.org",
  410. "company": {
  411. "name": "Considine-Lockman",
  412. "catchPhrase": "Synchronised bottom-line interface",
  413. "bs": "e-enable innovative applications"
  414. }
  415. },
  416. {
  417. "id": 7,
  418. "name": "Kurtis Weissnat",
  419. "username": "Elwyn.Skiles",
  420. "email": "Telly.Hoeger@billy.biz",
  421. "address": {
  422. "street": "Rex Trail",
  423. "suite": "Suite 280",
  424. "city": "Howemouth",
  425. "zipcode": "58804-1099",
  426. "geo": {
  427. "lat": "24.8918",
  428. "lng": "21.8984"
  429. }
  430. },
  431. "phone": "210.067.6132",
  432. "website": "elvis.io",
  433. "company": {
  434. "name": "Johns Group",
  435. "catchPhrase": "Configurable multimedia task-force",
  436. "bs": "generate enterprise e-tailers"
  437. }
  438. },
  439. {
  440. "id": 8,
  441. "name": "Nicholas Runolfsdottir V",
  442. "username": "Maxime_Nienow",
  443. "email": "Sherwood@rosamond.me",
  444. "address": {
  445. "street": "Ellsworth Summit",
  446. "suite": "Suite 729",
  447. "city": "Aliyaview",
  448. "zipcode": "45169",
  449. "geo": {
  450. "lat": "-14.3990",
  451. "lng": "-120.7677"
  452. }
  453. },
  454. "phone": "586.493.6943 x140",
  455. "website": "jacynthe.com",
  456. "company": {
  457. "name": "Abernathy Group",
  458. "catchPhrase": "Implemented secondary concept",
  459. "bs": "e-enable extensible e-tailers"
  460. }
  461. },
  462. {
  463. "id": 9,
  464. "name": "Glenna Reichert",
  465. "username": "Delphine",
  466. "email": "Chaim_McDermott@dana.io",
  467. "address": {
  468. "street": "Dayna Park",
  469. "suite": "Suite 449",
  470. "city": "Bartholomebury",
  471. "zipcode": "76495-3109",
  472. "geo": {
  473. "lat": "24.6463",
  474. "lng": "-168.8889"
  475. }
  476. },
  477. "phone": "(775)976-6794 x41206",
  478. "website": "conrad.com",
  479. "company": {
  480. "name": "Yost and Sons",
  481. "catchPhrase": "Switchable contextually-based project",
  482. "bs": "aggregate real-time technologies"
  483. }
  484. },
  485. {
  486. "id": 10,
  487. "name": "Clementina DuBuque",
  488. "username": "Moriah.Stanton",
  489. "email": "Rey.Padberg@karina.biz",
  490. "address": {
  491. "street": "Kattie Turnpike",
  492. "suite": "Suite 198",
  493. "city": "Lebsackbury",
  494. "zipcode": "31428-2261",
  495. "geo": {
  496. "lat": "-38.2386",
  497. "lng": "57.2232"
  498. }
  499. },
  500.  
  501. "phone": "024-648-3804",
  502. "website": "ambrose.net",
  503. "company": {
  504. "name": "Hoeger LLC",
  505. "catchPhrase": "Centralized empowering task-force",
  506. "bs": "target end-to-end models"
  507. }
  508.  
  509. }
  510.  
  511.  
  512.  
  513.  
  514. ];
  515.  
  516.  
  517. console.log("Part 1");
  518. for(var i = 0; i < myDb.length;i++){
  519. console.log(myDb[i].name);
  520. }
  521.  
  522. console.log("Part 2");
  523. for(var i = 0; i<myDb.length;i++){
  524. console.log("lat:" + myDb[i].address.geo.lat + " long: " + myDb[i].address.geo.lng);
  525. }
  526.  
  527. console.log("Part 3");
  528. for(var i = 0; i<myDb.length;i++){
  529. console.log("name: " + myDb[i].name + " id: " + myDb[i].id + " company name: " + myDb[i].company.name + " zipcode: " + myDb[i].address.zipcode);
  530. }
  531.  
  532. console.log("Part 4")
  533. for(var i = 0; i<myDb.length;i++){
  534. if(myDb[i].address.zipcode[0] == 5){
  535. console.log("zipcodes: " + myDb[i].address.zipcode);
  536.  
  537. }
  538. }
  539.  
  540. </script></body>
  541. </html>
Add Comment
Please, Sign In to add comment