Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

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


Auto Save

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.






                aGlobalVariable ="my name is global"
var stillGlobal =, function(){ return aGlobalVariable})

//lexical scope
aVar = "Outside"

function aFun(){
    var aVar = "Inside"
    return,3,1), function(val){   
        var aVar = "InsideAnAnonym"
        return [aVar, val].join(" ")

//this reference 
function globalThis(){ return this; }

var nopeThis = _.bind(globalThis, "nope")

//Function Scope

function strangeJS(n){
    var i;
    for(i =0; i < n; i++);
    return i;
//strangeJS(5) = 5
var n = 34
function checkIfGlobal(n){ 
  this["n"] = n;
  return this
//console.log(checkIfGlobal(5)) returns the Window/Global object
//console.log({}, 5))  returns {n:5}

function f(){
  this["a"] = 1;
  return this["a"] + this["b"]

//console.log(f())  returns NaN
var g = {b:5}
///console.log( returns 6
//console.log(g) returns {b:5}

//closure  and free variables 
function Big(){
    var name = "Comfort Ajala"
    return function(){ return name + ", Hello there Girl!"} //local variable captured 
var reportName = Big()
//console.log(reportName()) prints "Comfort Ajala, Hello there Girl!"

function captureArgument(ar){
    return function(t){ return, function(val){ return val + t * 33 - 1 + ""})}

var arg = captureArgument([22,5,5667,88,3])
// console.log(arg(4)) ["153", "136", "5798", "219", "134"]
var name = "Freddy"
var name = "Tower"

//console.log(name) = Tower,bu

var shad = 0
function arshad(shad){ return ["Value is ", shad].join(" ")}

/*console.log(arshad()) = "Value is  "
console.log(arshad(6)) = "Value is  6"

//captured value changes or nah
function isEven(n){ return n % 2 == 0 ?  "Even" : "Odd"}

function clap(fun){
  return function(n){return ["The number provided is ", fun(n)].join(" ")}

var calc = clap(isEven)
console.log(calc(4)) //"The number provided is  Even"
console.log(calc(5))//"The number provided is  Odd"
function isEven(n){ return 5 * 23;}