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 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


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.


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.


                <!-- The print() function -->
// the custom log function
  function log(str) {
	// create a new element
    let p = document.createElement('p');
    // set the innerHTML of the created element as the function parameter
    p.innerHTML = str;
    // append the element to the document body




                function rootOf(number) {
    return new Promise(function (resolve) {
        // checks if the number is greater than zero (and positive) and whether or not the number is a perfect square
        let isPerfectSquare = number > 0 && Math.sqrt(number) % 1 === 0;

        if (isPerfectSquare) {
            // if the number is a perfect square, resolve its root after 3 seconds (3000 milliseconds)
                }, 3000);


// the async function
async function sumOfRootsAsync(num1, num2, num3) {
	let root1 = await rootOf(num1);
    let root2 = await rootOf(num2);
    let root3 = await rootOf(num3);
    return root1 + root2 + root3;

sumOfRootsAsync(36, 49, 64).then(function(sum) {