Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

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.

              <p><b>Be sure to open to console to view the results.</b></p>
<br />
<br />
<hr />
<p style="text-align:left;">If you find this demo useful, please consider <a href="https://www.paypal.me/RobertGravelle/1" target="_blank">donating $1 dollar</a> (secure PayPal link) for a coffee or purchasing one of my songs from <a href="https://ax.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?term=rob%20gravelle" target="_blank">iTunes.com</a> or <a href="http://www.amazon.com/s/ref=ntt_srch_drd_B001ES9TTK?ie=UTF8&field-keywords=Rob%20Gravelle&index=digital-music&search-type=ss" target="_blank">Amazon.com</a> for only 0.99 cents each.</p>
<p style="text-align:left;">Rob uses and recommends <a href="http://www.mochahost.com/2425.html" target="_blank">MochaHost</a>, which provides Web Hosting for as low as $1.95 per month, as well as unlimited emails and disk space!</p>
              "use strict";

function DuckTypeError() {
    var temp = TypeError.apply(this, arguments);
    temp.name = this.name = 'DuckTypeError';
    this.message = temp.message;
    if(Object.defineProperty) {
        // getter for better optimization
        /*this.stack = */Object.defineProperty(this, 'stack', { 
            get: function() {
                return temp.stack
            configurable: true // so you can change it if you want
    } else {
        this.stack = temp.stack
//inherit prototype using ECMAScript 5 (IE 9+)
DuckTypeError.prototype = Object.create(TypeError.prototype, {
    constructor: {
        value: DuckTypeError,
        writable: true,
        configurable: true

function Infiniti(model) { 
    this.model = model;
Infiniti.prototype.accelerate = function() {
    console.log(this.model + ": Going from 0 to 60mph really fast!");

function Honda(model) {
    this.model = model;
Honda.prototype.accelerate = function() {
    console.log(this.model + ": Going from 0 to 60mph at a moderate speed.");

function Hyundai(model) {
    this.model = model;
Hyundai.prototype.accelerate = function() {
    console.log(this.model + ": Going from 0 to 60mph at a crawl.");

function Couch(type) {
    this.type = type;

function race(car) {
    //Dynamically invoke accelerate() method 
    //of whatever car was passed in.
    if (car.accelerate) 
      throw new DuckTypeError("Hey, you're not a car!");

//Let's race some cars!
var cars = [
  new Infiniti("G37"),
  new Honda("Civic"),
  new Hyundai("Accent")
for (var i in cars) { 

//try to race a sofa!?
race( new Couch("Sofa") ); 

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.