Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. function makeList(item1, item2, item3) {
  2. return [item1, item2, item3]
  3. }
  4.  
  5. /*Why can I not just return function makeList?*/
  6.  
  7.  
  8. /* From here down, you are not expected to
  9. understand.... for now :)
  10.  
  11.  
  12. Nothing to see here!
  13.  
  14. */
  15.  
  16. // tests
  17.  
  18. function testMakeList() {
  19. const items = ['prime rib', 'fried goat cheese salad', 'fish tacos'];
  20. const result = makeList(items[0], items[1], items[2]);
  21.  
  22. if (
  23. result &&
  24. result.length &&
  25. items.length === result.length &&
  26. items.every(function(item) {
  27. return result.indexOf(item) > -1;
  28. })
  29. ) {
  30. console.log('SUCCESS: `makeList` works!');
  31. } else {
  32. console.error('FAILURE: `makeList` is not working');
  33. }
  34. }
  35.  
  36. testMakeList();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement