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.


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.

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.






                // 定义构造函数
function C(){} 
function D(){} 

var o = new C();
// true,因为 Object.getPrototypeOf(o) === C.prototype
console.log(o instanceof C);
console.log(o instanceof C);
// false,因为 D.prototype不在o的原型链上
console.log(o instanceof D);
// true,因为Object.prototype.isPrototypeOf(o)返回true
console.log(o instanceof Object);
 // true,同上
console.log(C.prototype instanceof Object);

C.prototype = {};
var o2 = new C();
console.log(o2 instanceof C);// true
// false,C.prototype指向了一个空对象,这个空对象不在o的原型链上.
console.log(o instanceof C);

D.prototype = new C(); // 继承
var o3 = new D();
console.log(o3 instanceof D);// true
console.log(o3 instanceof C);// true
console.log(o3 instanceof Object);// true

var obj = [1,2,3];
console.log(obj instanceof Array);// true
console.log(obj instanceof Object);// true