Advertisement
Guest User

Untitled

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