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

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                 ///////////////////////Exercises /////////////////////////

//1. Declare a switch statement that evaluates the answer to the question on line 8 below and prints to the console the position in the alphabet the letter is at. This should work for any person's name, not just yours. 
// the default case should return something like 
// "you have not entered a letter in the alphabet"
// The first case is already provided. 
  
  let name = prompt('What letter does your name start with?');

  switch(name){
    case 'A':
      console.log("A is the 1st letter of the alphabet");
      break;
  }


// 2. Complete the switch statement that evaluates the variable 'age' against 9 different cases:
//   Each case will represent a decade, and test whether the age variable is within that decade.
//   If the age is within that decade, print a statement to the console describing what stage of life or decade they are in (Ex: you are in your childhood, you are in your thirties, you are soooo old, etc.)
// The first case is provided: 

let age = 21;

switch(true) {
    case age <= 10:
      console.log("You are in your childhood");
      break;
   }
// The default case should print "You are ___ years old" to the console, where the blank is the value of the age variable

/////////////////Extra Exercises:

//1. Design your own switch statement! Make it switch through at least five different cases, and print out something different to the console. Be creative! Remember, you can create variables above your switch statement to use in it! Think of lists of things that you could check. Remember the examples of days of the week, months, etc. 


              
            
!
999px

Console