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

              
                //today is a variable storing a new JavaScript Date object. 
let today = new Date();
//day is a variable storing the numeric value for today's day out of the week
let day = today.getDay();

//Pay attention to the syntax of the switch statement. First, begin with the keyword switch() with the tested variable within the parenthesis:

//The switch statement's cases go inside of the curly brackets:
      switch(day) {
          // The first case on the next line contains the code to execute in the case that day is equal to 0. This is the equivalent of testing " if(day == 0) "
        case 0:
        // if this case is true, the day is Sunday. We print this to the console.
          console.log("It's Sunday");
          //It is important to include a break statement at the end of each case in a switch statement, so that the program stops checking each condition after the case has evaluated as true, and the switch statement is exited
         //Ensuring that the program does not continue to check the rest of the cases improves the program's efficiency 
          break;
         // the next line is the equivalent of testing " if(day == 1) "
        case 1:
          confirm("It's Monday");
          break;
        case 2:
         confirm("It's Tuesday");
          break;
        case 3:
          confirm("It's Wednesday");
          break;
        case 4:
          confirm("It's Thursday");
          break;
        case 5:
          cconfirm("It's Friday");
          break;
        case 6:
          confirm("It's Saturday");
          break;
       // the default case is simply declared by saying default: rather than case ___: 
        default: 
          confirm("I'm not sure what day of the week it is actually!");
      }
              
            
!
999px

Console