Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <!-- Read the full post at https://jen4web.substack.com/p/kbd -->
 
<h1>Challenge for < kbd> and < samp></h1>

  <p>INSTRUCTIONS: Fork this CodePen and markup the content below.</p> 

<p><a href="https://jen4web.substack.com/p/kbd-discussion" target="_blank" class="button">Share your answer on Substack</a></p>
<hr> <!-- hr: a thematic break in a section. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr -->
  
  <h1>What Should I Eat?</h1>
  
<p>Write a JavaScript function that takes in an array of foods and randomly selects one to return. </p>
  
  <p>To run your program, paste the code into your browser's console. In Chrome, use <kbd>Option</kbd>+ <kbd>Command</kbd> + <kbd>I</kbd>, and in Firefox, use <kbd>Command</kbd>+ <kbd> C</kbd> to access the console. (Replace <kbd>Command</kbd> with <kbd>Control</kbd> if you're on a PC).</p>

  <p>Example output:</p>
  <samp>'Mmmm broccoli -- delicious!'</samp> 
  <pre>
  <code>
function what2Eat(choices) {
    return choices[Math.floor(Math.random() * choices.length)];
}

let food = what2Eat([ 'apples', 'pizza', 'cookies', 'tacos']);
console.log(`Mmmm ${food} -- delicious!`);
  </code>
   
   </pre>
              
            
!

CSS

              
                /* default styling - you don't need to touch this unless you really want to */
body {
  font-family: Arial, sans-serif;
  font-size: 1.2rem;
}
.button {
  background-color: #eb3b5a;
  padding: 0.5rem 1rem;
  border: 1px solid #eb3b5a;
  border-radius: 30px;
  color: white;
  text-decoration: none;
  font-weight: bold;
  display: inline-block;
  margin-bottom: 5rem;
}
.button:hover {
  color: #eb3b5a;
  background-color: white;
}
              
            
!

JS

              
                /* 

💯 This challenge is certified 100% free of JavaScript. 

ALL THE GOOD STUFF IS IN THE HTML BLOCK :-D

*/
              
            
!
999px

Console