cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="controls">
  <button onclick="prev()">&lt;</button>
  <button onclick="next()">&gt;</button>
</div>

<div class="primary">
<pre><code class="javascript">
let useEvens = true;
[1, 2, 3]
  .if(useEvens)
  .filter(x => x % 2 === 0)
  .else()
  .filter(x => x % 2 === 1)
  .endif()
  .forEach(doSomething)
</code></pre>
<pre><code class="javascript">
let useEvens = true;

<span>[Seque]</span>
  .filter(x => x % 2 === 0)
  .else()
  .filter(x => x % 2 === 1)
  .endif()
  .forEach(doSomething)
</code></pre>
<pre><code class="javascript">
let useEvens = true;


<span>[Seque]</span>
  .else()
  .filter(x => x % 2 === 1)
  .endif()
  .forEach(doSomething)
</code></pre>
<pre><code class="javascript">
let useEvens = true;



<span>[Seque]</span>
  .filter(x => x % 2 === 1)
  .endif()
  .forEach(doSomething)
</code></pre>
<pre><code class="javascript">
let useEvens = true;




<span>[Seque]</span>
  .endif()
  .forEach(doSomething)
</code></pre>
<pre><code class="javascript">
let useEvens = true;





<span>[Seque]</span>
  .forEach(doSomething)
</code></pre>
<pre><code class="javascript">
let useEvens = true;


<span>[Seque:</span>
[1, 2, 3]
  .filter(x => x % 2 === 0)
<span>]</span>
  .forEach(doSomething)
</code></pre>
<pre><code class="javascript">
let useEvens = true;


<span>[Seque:</span>

[2]
<span>]</span>
  .forEach(doSomething)
</code></pre>
<pre><code class="javascript">
let useEvens = true;





[2]
  .forEach(doSomething)
</code></pre>
</div>

<div class="secondary">
<pre></pre>
<pre><code class="javascript">
Until: endif
Wrapped: [1, 2, 3]
Condition: true
Callstack: [

]
</code></pre>
<pre><code class="javascript">
Until: endif
Wrapped: [1, 2, 3]
Condition: true
Callstack: [
  ['filter', [Function]]
]
</code></pre>
<pre><code class="javascript">
Until: endif
Wrapped: [1, 2, 3]
Condition: true
Callstack: [
  ['filter', [Function]],
  ['else', []]
]
</code></pre>
<pre><code class="javascript">
Until: endif
Wrapped: [1, 2, 3]
Condition: true
Callstack: [
  ['filter', [Function]],
  ['else', []],
  ['filter', [Function]]
]
</code></pre>
<pre><code class="javascript">
Until: endif
Wrapped: [1, 2, 3]
Condition: true
Callstack: [
  ['filter', [Function]],
  ['else', []],
  ['filter', [Function]]
]

endif reached -
split callstack @ 'else'
and apply the first half
</code></pre>
<pre><code class="javascript">

Wrapped: [1, 2, 3]

To Apply: [
  ['filter', [Function]]
]
</code></pre>
<pre><code class="javascript">

Wrapped: [2]

To Apply: [

]

Nothing left, return
current value
</code></pre>
<pre></pre>
</div>
            
          
!
            
              pre {
  position: absolute;
  margin-right: 1rem;
  opacity: 0;
  transition: all .3s;
}
.secondary pre {
  right: 0;
}

span {
  color: red;
}

div{
  position: absolute;
}

.primary{
  left: 0;
  top: 0;
}
.secondary {
  right: 0;
  top: 0;
}
.controls {
  width: 100%;
  text-align: center;
}
            
          
!
            
              hljs.initHighlightingOnLoad();
var slides = $('.primary pre');
var metaSlides = $('.secondary pre');
var slide = 0;
slides[slide].style.opacity = 1;
metaSlides[slide].style.opacity = 1;

function change(x) {
  slides[slide].style.opacity = 0;
  metaSlides[slide].style.opacity = 0;
  slide = (slide + x + slides.length) % slides.length;
  slides[slide].style.opacity = 1;
  metaSlides[slide].style.opacity = 1;
}

function next() { change(1); }
function prev() { change(-1); }
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console