1. 程式人生 > >JS構造函數

JS構造函數

html scrip type udt proto body var mod model

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
function LayerPoperty(cloudType,version,lineId,modelChunk) {
this.cloudType=cloudType;
this.version=version;
this.lineId=lineId;
this.modelChunk=modelChunk;
}
LayerPoperty.prototype.getVersion=function () {
return this.version;
}
var p=new LayerPoperty("wire",2017,435,‘1-200‘);
alert(p.getVersion());
</script>
</body>
</html>

JS構造函數