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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              
            
          
!

CSS

            
              
            
          
!

JS

            
              ///////////////////////////////// String Operators ////////////////////////////////

   // JavaScript's string operators are used to attach strings to one another, or to attach variables to strings.

   // String operators each have a symbol known as the operator that is used to perform the operation

     
      // 1. Concatenation : concatenate is another word for add. Concatenating two strings simply means adding or attatching them to one another.
         // Operator: + 
         // Examples:
         x = "My name is ";
         y = "Hulk Hogan, ";
         z = "Brothur";
         var sentence = x + y + z;
         // Q : What is the value of the variable sentence?

         //  *** Note that this operator (+) is also used for numerical addition. 
        
         // You may ask how you are supposed to specify that you are adding strings instead of numbers, and the answer is that you do not have to. 

         // If any value you are adding is a string, the compiler automatically uses the + operator to concatenate values to the string, even if they are numbers. The result is a string. For example:

         var cents = 93;
         var sentenceWithNumbers = "I have " + 16 + " dollars and " + cents + " cents.";
         console.log(sentenceWithNumbers);

         // If you check the console, you see that the value of sentenceWithNumbers is one string that states "I have 16 dollars and 93 cents."

         // Note that between each value or variable added, another addition sign needs to be used to concatenate the entire string. 
    
        // It is good practice to pay attention to where spaces should be inserted so that the sentence's formatting is not confusing and bunched together when the string is printed out.

        // Typically if you are printing a string and then a new variable or string, you want to make sure there is a space included at the end of the first string, or the beginning of the second. 
      
        // If a numeric value is printed before another or before a string, you can concatenate a single space before the next number, or include a space in the beginning of the next string


      // 2. Concatenate-Equals : assigning a variable to its original value plus some specified value concatenated to it
         // Operator: += 
         // Examples:
         x = "My name is ";
         y = "Hulk Hogan,";
         z = "Brothur";
         var sentence = x + y + z;
         x += y + z;
         // Q : What is the value of variable x? Is this equal to the value of sentence?

///////////////////////// Exercises /////////////////////////
// 1. Declare a new variable named myLocation, and set it equal to the name of your town. 
// 2. Update the value of the string to include the current value, PLUS the name of your state in this format: ", Louisiana". Print the updated value to the console. The printed format should be City, State
// 3. Print the following phrase to the console by concatenating a string with the value of myLocation: "I live in ___City, State____"
// 4. Declare the new variables name, age, color, and food. Set the value of name to your name, age to your age, color to your favorite color, and food to your favorite food or the last thing you ate.
// 5. Print the statement to the console, filling in the blanks by concatenating the appropriate variables: "My name is _____. I am ____ years old. My favorite color is ____ and the last thing I ate was _______."
            
          
!
999px

Console