JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.

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

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

` ````
.container
h1 Math
b Let's generate a list of number between 0 and 5
p(var="list")
b Now, let's do the sum of this list
p(var="sum")
b We could also find the average of this list
p(var="average")
b ... and the median
p(var="median")
b But we can also do super cool things <br>
| such as predicting a logical sequence.
p Let's say we have a sequence of 3 numbers We can predict what would be the fourth number, and what is the function.
input(type="text" target="sequence" placeholder="3, 5, 7")
p(var="logic")
h2 Like what you see? Learn DisplayJS!
```

` ````
.container
text-align: center
```

` ````
// declaring init var
var $ = new DisplayJS(window);
var list = $.range(5)
var sum = $.sum(list)
var sequence = '3, 5, 7'
var logicSeq = [3, 5, 7]
array = {}
for(let i in $.range(logicSeq.length - 1)) {
array[parseInt(i) + 1] = logicSeq[i]
}
logic = $.predict(array, logicSeq.length + 1, true)
var average = $.average(list)
var median = $.median(list)
$.var()
$.target(function () {
logicSeq = eval(`[${sequence}]`)
array = {}
for(let i in $.range(logicSeq.length - 1)) {
array[parseInt(i) + 1] = logicSeq[i]
}
logic = $.predict(array, logicSeq.length + 1, true)
$.var()
})
```

999px

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

Alt F
Opt F
Find & Replace

Also see: Tab Triggers