Pen Settings



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


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



Go PRO Window blinds lowered to protect code. Code Editor with window blinds (raised) and a light blub turned on.

Keep it secret; keep it safe.

Private Pens are hidden everywhere on CodePen, except to you. You can still share them and other people can see them, they just can't find them through searching or browsing.

Upgrade to PRO


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.


Make Template?

Templates are Pens that can be used to start other Pens quickly from the create menu. The new Pen will copy all the code and settings from the template and make a new Pen (that is not a fork). You can view all of your templates, or learn more in the documentation.

Template URL

Any Pen can act as a template (even if you don't flip the toggle above) with a special URL you can use yourself or share with others. Here's this Pen's template URL:


Screenshots of Pens are shown in mobile browsers, RSS feeds, to users who chose images instead of iframes, and in social media sharing.

This Pen is using the default Screenshot, generated by CodePen. Upgrade to PRO to upload your own thumbnail that will be displayed on previews of this pen throughout the site and when sharing to social media.

Upgrade to PRO






//*** Introduction to JavaScript LAB 2: Variables and Operators, Data Types, and Functions ***//

//Let's declare a variable

var x; //Without being initialized to a value, its value is set to undefined

console.log(x); //undefined

//Let's give it a value!

x = 7;

//Remember, 7 is a number. We can see that by using the special typeof keyword

console.log(typeof x) //number

//Let's change it to a string.

x = "seven";

console.log(typeof x) //string

//Okay, back to a number...

x = 7;

//And let's make sure by using a comparison operator (we'll look at these in depth later on...) 

console.log(typeof x == "string"); //false
console.log(typeof x == "number"); //true

//Now let's get some other variables in the mix!

var y = 8, z = 10;

//And lets do some operations!

console.log(x + y); //15

var sum = x + y;

console.log(sum - z); //5

//Now let's wipe 'em all clean...

x = y = z = null;

console.log(x, y, z) //null null null

//The space below is for you to practice! Try declaring some variables and doing some operations on them.
//Use console.log() to output the results to the console

//Now let's look at some data structures

var myArray = []; //This is an empty array; let's add some elements to it!

myArray[0] = "one";
myArray[1] = "two";
myArray[2] = 3;

console.log(myArray); //["one", "two", 3]

var myObject = {}; //This is an empty object; let's add some properties and values! = 1;
myObject["two"] = 2;
myObject.three = "three";

console.log(myObject) /*

                      Object {
                        one: 1,
                        three: "three",
                        two: 2

//Finally, let's get funky with some functions!

//Function expression
var myFunction = function () {
  return "Up-town...";

//Call it

//Log the call
console.log(myFunction()); //...logs "Up-town..." to the console

//Function declaration
function myFunction1 () {
  return "func you up!";

//MyFunction's return value added to (concat-enated with) myFunction1's return value

var upTownFunc = myFunction() + myFunction1();

console.log(upTownFunc); //...logs "Up town...func you up!" to the console

//Parameters and passing arguments

function myAdder(a, b) {
  return a + b;

//Set a variable equal to the return value of myAdder with two arguments passed to it

var added = myAdder(1, 2);

console.log(added); //3

//Well done! You *passed!*
How would you React if I said I love Vue?