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

              
                // // Javascript : Operators

// // Operators are used in programming to assign new values, compare values, test values, update values, perform arthmetic on values, etc.

// // In short, operators are used to manipulate variables in a number of ways. 

// // So far, we've only really dealt with the default assignment operator, =, like when we say:
    
//     var usingAssignmentOperator = "<-- Thats the common assignment operator";

// // In total, there are seven categories of operators in JavaScript. 

// // These include operators for arthmetic operations, assignments, string operations, comparisons, logical operations, conditional operations, and other types of operators that are worth mentioning.
   
// ///////////////////////////////// Arithmetic Operators ////////////////////////////////
   
//    // JavaScript's arthmetic operators are used to perform arithmetic in your code. 
//    // Arthmetic operators each have a symbol known as the operator that is used to perform the operation.

//       // 1. Addition : adding two values or variables together
//          // Operator: + 
//          // Examples:
//          let sum = 5 + 7000;
//          let x, y;
//          x = 20;
//          y = 30;
//          let z = x + y + 400; 
//          // Q : What is the value of variable z?

//       // 2. Subtracting : subtracting one value or variable from another
//          // Operator: - 
//          // Examples:
//          let minus = 300 - 87;
//          let a, b;
//          a = 83;
//          b = 65;
//          let c =  a - b; 
//          // Q : What is the value of variable c?

//       // 3. Multiplication : mutliplying multiple values or variables together
//          // Operator: *
//          // Examples:
//          let product = 75 * 39;
//          let j, k;
//          j = 14;
//          k = 92;
//          let l = j * k * .5; 
//          // Q : What is the value of variable l?

//       // 4. Division : dividing one or more values or variables by another
//          // Operator: /
//          // Examples:
//          let quotient = 5016 / 6;
//          let q, w;
//          q = 46;
//          w = 138;
//          let p = (w / q) / 3; // When there are multiple operations on a single line, the answer is calculated in the order of PEMDAS 
//          // Q : What is the value of variable p?

//       // 5. Modulus : retrieving the remainder of one or more values or variables being divided by another
//          // Operator: %
//          // Examples:
//          let modulus = 33%15; // the value of modulus would be 3, because 32 goes into 15 twice, with 3 left over.
//          let h = 46;
//          let i = 13;
//          let g = h % i;  
//          // Q : What is the value of variable g?

//       // 6. Increment : increasing the value of a variable by 1 (adding 1)
//          // Operator: ++
//          // Examples:
//          let someValue = 10;
//          someValue++;
//          let newValue = someValue++;
//          // Q : What is the value of the variable named newValue?

//       // 7. Decrement : decreasing the value of a variable by 1 (subtracting 1)
//          // Operator: --
//          // Examples:
//          let someOtherValue = 90;
//          someOtherValue--;
//          let anotherNewValue = someOtherValue--;
//          // Q : What is the value of the variable named anotherNewValue?

//    // The operators can be used on fixed values, such as:
//       let adding = 5 + 5;
//       let subtracting = 10 - 5;
//       let dividing = 40 / 5;
//       let multiplying = 80 * 3;
//       let modulos = 20 % 8;
   
//    // Arithmetic operators can also be used on variables:
//       let number = 50;
//       let newAdding =  adding + number;
//       let newSubtracting = subtracting - number;
//       let newDividing = number / dividing;
//       let newMultiplying = multiplying * number;
//       let newModulos = number % modulos;

//    // The operators can even be used with a mix of fixed values and variables:
//       newAdding =  adding + 30;
//       newSubtracting = subtracting - 23;
//       newDividing = 5 / dividing;
//       newMultiplying = multiplying * 7;
//       newModulos = 24 % modulos;

///////////////////////// Exercises /////////////////////////
// 1. Declare the variables x, y, and z, and set them equal to 13, 27, and 94

// 2. Print the sum of all three variables to the console, and using your knowledge of string concatenation, print the statement "The sum of x, y, and z is ", followed by the sum, all on one line.

// 3. Print the difference between z and y, divided by x tox the console in the format "The difference between z and y, divided by x is _____" where the blank is the value.

// 4. Declare a new variable named 'age' and set it equal to your age. Increment this variable by 1 on the next line.

// 5. Print the age variable to the console in this format: "In one year I will be ___" where the blank is the value of your age.

/////Extra Exercises: 

//1. Create a variable called x, and set it equal to a number of your choice. Create another variable called y, and set it equal to another number of your choice. 

//2. Calculate x multiplied by y, and print the answer to the console. 

//3. Below that, calculate x divided by y, and print it to the console. 

//4. Calculate x multiplied by (y divided by x) and print it to the console. 

//5. Calculate x plus y increment (remember the correct operator for increment!). Print the value to the console. 
              
            
!
999px

Console