Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.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. function makeList(item1, item2, item3) {
  12. return [item1, item2, item3]
  13. }
  14.  
  15.  
  16.  
  17. /* From here down, you are not expected to
  18. understand.... for now :)
  19.  
  20.  
  21. Nothing to see here!
  22.  
  23. */
  24.  
  25.  
  26. // tests
  27.  
  28. function testMakeList() {
  29.  
  30. var items = ["prime rib", "fried goat cheese salad", "fish tacos"];
  31. var result = makeList(items[0], items[1], items[2]);
  32.  
  33. if (
  34. result && result.length && items.length === result.length &&
  35. items.every(function(item) {
  36. return result.indexOf(item) > -1;
  37. })) {
  38. console.log('SUCCESS: `makeList` works!');
  39. } else {
  40. console.error('FAILURE: `makeList` is not working');
  41. }
  42. }
  43.  
  44. testMakeList();
  45. </script>
  46.  
  47.  
  48.  
  49. <script id="jsbin-source-javascript" type="text/javascript">function makeList(item1, item2, item3) {
  50. return [item1, item2, item3]
  51. }
  52.  
  53.  
  54.  
  55. /* From here down, you are not expected to
  56. understand.... for now :)
  57.  
  58.  
  59. Nothing to see here!
  60.  
  61. */
  62.  
  63.  
  64. // tests
  65.  
  66. function testMakeList() {
  67.  
  68. var items = ["prime rib", "fried goat cheese salad", "fish tacos"];
  69. var result = makeList(items[0], items[1], items[2]);
  70.  
  71. if (
  72. result && result.length && items.length === result.length &&
  73. items.every(function(item) {
  74. return result.indexOf(item) > -1;
  75. })) {
  76. console.log('SUCCESS: `makeList` works!');
  77. } else {
  78. console.error('FAILURE: `makeList` is not working');
  79. }
  80. }
  81.  
  82. testMakeList();</script></body>
  83. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement