Skip to content

Instantly share code, notes, and snippets.

@jigewxy
Created September 25, 2017 03:14
Show Gist options
  • Save jigewxy/0491891a899ae4fb885e8232d40cfe2d to your computer and use it in GitHub Desktop.
Save jigewxy/0491891a899ae4fb885e8232d40cfe2d to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/yesudozeza
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
Exporter = function ( type, data, options ) {
this.type = type;
this.data = data || [];
this.options = options || {};
}
Exporter.prototype.sayHello = function(str){
console.log(str);
}
//下面这行可以让Exporter.prototype包括type, data 和options
Exporter.prototype = new Exporter();
Exporter.prototype.constructor = Exporter;
console.log(Exporter.prototype);
var Obj1 = new Exporter('feature', '11111', 'Fix');
var Obj2 = new Exporter('feature', '22222', 'Fix');
//console.log(Obj1);
//console.log(Obj2);
/*ChildExp = function(type, data, options, time){
Exporter.call(this, type, data, options);
this.time = time;
}
ChildExp.prototype = new Exporter();
console.log(ChildExp);
var myObj = new ChildExp('feature', '371891', 'Fix', '2017');
console.log(myObj); */
//console.log(new Exporter());
//Exporter.prototype.constructor = Exporter;
//var myObj = new ChildExp('feature', '371891', 'Fix');
//console.log(myObj);
//console.log(myObj.constructor);
</script>
<script id="jsbin-source-javascript" type="text/javascript">
Exporter = function ( type, data, options ) {
this.type = type;
this.data = data || [];
this.options = options || {};
}
Exporter.prototype.sayHello = function(str){
console.log(str);
}
//下面这行可以让Exporter.prototype包括type, data 和options
Exporter.prototype = new Exporter();
Exporter.prototype.constructor = Exporter;
console.log(Exporter.prototype);
var Obj1 = new Exporter('feature', '11111', 'Fix');
var Obj2 = new Exporter('feature', '22222', 'Fix');
//console.log(Obj1);
//console.log(Obj2);
/*ChildExp = function(type, data, options, time){
Exporter.call(this, type, data, options);
this.time = time;
}
ChildExp.prototype = new Exporter();
console.log(ChildExp);
var myObj = new ChildExp('feature', '371891', 'Fix', '2017');
console.log(myObj); */
//console.log(new Exporter());
//Exporter.prototype.constructor = Exporter;
//var myObj = new ChildExp('feature', '371891', 'Fix');
//console.log(myObj);
//console.log(myObj.constructor);
</script></body>
</html>
Exporter = function ( type, data, options ) {
this.type = type;
this.data = data || [];
this.options = options || {};
}
Exporter.prototype.sayHello = function(str){
console.log(str);
}
//下面这行可以让Exporter.prototype包括type, data 和options
Exporter.prototype = new Exporter();
Exporter.prototype.constructor = Exporter;
console.log(Exporter.prototype);
var Obj1 = new Exporter('feature', '11111', 'Fix');
var Obj2 = new Exporter('feature', '22222', 'Fix');
//console.log(Obj1);
//console.log(Obj2);
/*ChildExp = function(type, data, options, time){
Exporter.call(this, type, data, options);
this.time = time;
}
ChildExp.prototype = new Exporter();
console.log(ChildExp);
var myObj = new ChildExp('feature', '371891', 'Fix', '2017');
console.log(myObj); */
//console.log(new Exporter());
//Exporter.prototype.constructor = Exporter;
//var myObj = new ChildExp('feature', '371891', 'Fix');
//console.log(myObj);
//console.log(myObj.constructor);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment