Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                /* 
1)
Implement the function chooseMovieSnacks so that it returns the statement
'My favorite movie snacks are <snack1> and <snack2>'. 
<snack1> and <snack2> value will depend on the parameter that are passed as arguments.
Ex: 
const snacks = ['peanuts', 'popcorn', 'hot dogs', 'candy', 'ice cream'];
const favorites = chooseMovieSnacks(snacks, 1, 3);
// favorites should read 'My favorite movies snacks are popcorn and candy.';
*/
const chooseMovieSnacks = (arr, index1, index2) => {
  // YOUR CODE HERE
};

/* 
2)
Given a daily menu object, implement the function 'getLunch' so that it returns 
the menu item that is for lunch
*** EXAMPLE ***
const mondayMenu = {
  breakfast: 'eggs',
  lunch: 'sandwich',
  dinner: 'stir-fry'
};
const result = getLunch(mondayMenu) // result should equal 'sandwich'
*/

const getLunch = (menu) => {
  // YOUR CODE HERE
};

/*
Given a daily menu object, implement the function function 'getMeal' so that it returns
the value of inputted meal.
*** EXAMPLE ***
const mondayMenu = {
  breakfast: 'eggs',
  lunch: 'sandwich',
  dinner: 'stir-fry'
};
const result = getMeal(mondayMenu, 'dinner') // result should equal 'sandwich'
*/

const getMeal = (menu, meal) => {
  // YOUR CODE HERE
};

/*
3)
Given an array of menu objects, return an array of the menu objects where the dinner
property has a lowSugar equal to true.
*** EXAMPLE ***
const mondayMenu = {
  breakfast: 'eggs',
  lunch: 'sandwich',
  dinner: {
    item: 'stir-fry',
    lowSugar: false
  }
};
const tuesMenu = {
  breakfast: 'waffles',
  lunch: 'sandwich', 
  dinner: {
    item: 'pork chops',
    lowSugar: true
  }
}
const menuArr = [mondayMenu, tuesdayMenu];
const result = getLowSugarMenu(menuArr) 
// result should be an array contain only the tuesMenu object 
*/
const getLowSugarMenu = (menuArr) => {
  // YOUR CODE HERE
};

/*
4)
Implement the function copyMenu below that passes all the menus and menu items
by value. Changes to the new menu should not affect the old menu.
*/
const copyMenu = (menuArr) => {
  // YOUR CODE HERE
};
              
            
!
999px

Console