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

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

              
                <h3 id="results"></h3>
<button onClick="timeBackwards()">Time Backwards</button>
<button onClick="timeForwards()">Time Forwards</button>
<button onClick="timeOfLoop()">Time For...Of</button>
<button onClick="timeForEach()">Time forEach</button>
<button onClick="timeJqueryEach()">Time Jquery Each</button>

              
            
!

CSS

              
                
              
            
!

JS

              
                var arr = []
for(let i = 0; i < 1000000000;i++){
  arr.push(i)
}

function timeForwards(){
  let t0 = performance.now();
  for (let i = 0; i< arr.length; i++){
  }
  let t1 = performance.now();
  document.getElementById("results").innerHTML = "Call to timeForwards took " + (t1 - t0) + " milliseconds.";
}

function timeBackwards(){
  let t0 = performance.now();
  for (let i = arr.length-1; i>=0; i--){
  }
  let t1 = performance.now();
  document.getElementById("results").innerHTML = "Call to timeBackwards took " + (t1 - t0) + " milliseconds.";
}

function timeForEach(){
  let t0 = performance.now();
  arr.forEach(function(element) {
  });
  let t1 = performance.now();
  document.getElementById("results").innerHTML = "Call to timeForEach took " + (t1 - t0) + " milliseconds.";
}

function timeOfLoop(){
  let t0 = performance.now();
  for (let item of arr){
  }
  let t1 = performance.now();
  document.getElementById("results").innerHTML = "Call to timeOfLoop took " + (t1 - t0) + " milliseconds.";
}

function timeJqueryEach(){
  let t0 = performance.now();
  $.each(arr, function( index, value ) {
  });
  let t1 = performance.now();
  document.getElementById("results").innerHTML = "Call to timeJqueryEach took " + (t1 - t0) + " milliseconds.";
}

              
            
!
999px

Console