cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

	h1 Math
	b Let's generate a list of number between 0 and 5
	b Now, let's do the sum of this list
	b We could also find the average of this list
	b ... and the 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")
	h2 Like what you see? Learn DisplayJS!
              // 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]

var logic = $.predict([[1,logicSeq[0]],[2,logicSeq[1]],[3,logicSeq[2]]], 4, true)

var average = $.average(list)

var median = $.median(list)


$.target(function () {
	logicSeq = eval(`[${sequence}]`)
	if (logicSeq.length > 2) {
		logic = $.predict([[1,logicSeq[0]],[2,logicSeq[1]],[3,logicSeq[2]]], 4, true)
	else {
		logic = $.predict([[1,logicSeq[0]],[2,logicSeq[1]]], 4, true)
Loading ..................