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.

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

              
                ///////////////////////////////// Comparison Operators ////////////////////////////////

   // JavaScript's comparison operators are used in logical/conditional statements to determine if variables are equal to, less than, greater than, etc. another value or variable.

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

      // 1. Equal To : used to test whether a variable's value is equal to another variable's value or a fixed value
         // Operator: ==
         // Examples:
         let example = 5;
         let val = 6;
         example == 10 //(false) This line translates to "is the value of example equal to 10?"
         example == 5 //(true)
         example == val //(false)
         val = 5;
         example == val 
         // Q : What is the result of the comparison on line 16 (true or false)?

      // 2. Equal Value and Type : used to test whether a variable's data type and assigned value are equal to another variable or fixed value's assigned value and data type(it checks BOTH, if one is not the same, it is overall not equal)
         // Operator: ===
         // Examples:
         example = 5;
         val = "5";
         example === val; //false; This line translates to "is the value of example equal to 10 the value of val, AND are the data types the same?"
         example += val;
         example === val;
        // Q : What is the result of the comparison on line 26 (true or false)?

      // 3. Not Equal : used to test whether a variable's value is NOT equal to another variable's value or a fixed value. If it is not equal, it returns true. If the values are equal, it returns false.
         // Operator: !=
         // Examples:
         example = 29;
         val = 28;
         example != val; //true; This line translates to "is the value of example not equal to the value of val? 
         example != val++;
         example-- != val;
         // Q : What is the result of the comparison on line 35?
         // Q : What is the result of the comparison on line 36?

      // 4. Not Equal value or not equal type : used to test whether a variable's value OR data type is NOT equal to another variable's value and data type or a fixed value's value and data type. If either the values or types are not equal, it returns true. If the values are equal, it returns false.
         // Operator: !==
         // Examples:
         example = 10;
         val = "10";
         example !== val; //true; This line translates to "is the value of example not equal to the value of val, and is the data type of example also not the same as the data type of val? 
         val = 11;
         val--;
         example !== val;
         // Q : What is the result of the comparison on line 48 (true or false)?

      // 5. Greater Than : used to test whether a value or variable is greater than another value or variable
         // Operator: >
         // Examples:
         example = 300;
         val = 295;
         example > val; //true; This line translates to "is the value of example greater than the value of val?"
         val * 5;
         example > val; //false
         example = 300 * 3 % val;
         // Q : What is the result of the comparison on line 59?

      // 6. Less Than : used to test whether a value or variable is less than another value or variable
         // Operator: <
         // Examples:
         example = 46;
         val = 13;
         example < val; //false; This line translates to "is the value of example less than the value of val?"
         (example % val) < val; //true
         (val % example) < example; 
         // Q : What is the result of the comparison on line 70?

      // 7. Greater Than or Equal To : used to test whether a value or variable is greater than or equal to another value or variable
         // Operator: >=
         // Examples:
         example = 50;
         val = example;
         example++ >= val;//true; This line translates to "is the value of example+1 greater than or equal to the value of val?"
         example-- >= val++; 
         // Q : What is the result of the comparison on line 78?

      // 8. Less Than or Equal To : used to test whether a value or variable is less than or equal to another value or variable
         // Operator: =
         // Examples:
         example = 20;
         val = example*example;
         example <= val;//true; This line translates to "is the value of example less than or equal to the value of val?"
         example += val/2;
         val <= example;
         // Q : What is the result of the comparison on line 88?




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

let value1 = 13;
let value2 = 29;

// 1. What is the value of 'result'?
let result = (value1 != value2);

// 2. What is the value of rusult for each boolean below? 
value1 *= 7;
value2 += 50;
result = value2 >= value1; // your answer

value2 += (value1 - value2);
result = value2 == value1; // your answer

// 3. What is the value of rusult for each boolean below? 
let zipCode1 = "70808";
let zipCode2 = 70808;
result = zipCode1 === zipCode2; // your answer
result = zipCode1 == zipCode2; // your answer

zipCode2 = "70808";
result = zipCode1 === zipCode2; // your answer


// 4. Perform the appropriate operations on the drinks variable so that there
// are 3 times as many drinks as there are customers, making the variable 
// 'enoughDrinks' true. When this variable is true, print the statement 
// "It is ___ that there are enough drinks." where the blank is the value 
// of the enoughDrinks variable.

//Print the value of drinks and customers in this format:
// "There are ___ drinks total for the ___ customers, so that each customer has ____ drinks." Where the first blank is the value of the drinks variable, the second is the value of the customers variable, and the third is the quotient of drinks and customers.
let drinks = 10;
let customers = 70;
let enoughDrinks = drinks >= customers;



// 5. What will the value of result below be? 
let idk = 25;
let udk = 25;
idk += udk; // 50 
udk *= idk; //1250
result = (idk == (udk / 25));


              
            
!
999px

Console