![]()
<script>
window.onload = function (ev) {
var vcar=new Car("丰田","雷凌",55,1.8)
vcar.startup();
vcar.Startengine();
vcar.changeSpeed();
vcar.swerve();
vcar.stop();
vcar.Turnofftheengine();
}
function Car(make, model, currentSpeed, displacement) {
var currentSpeed=currentSpeed;
this.startup= function () {
document.write("启动:0")
}
this.Startengine =function () {
var speed = currentSpeed;
document.write("<br>"+"启动引擎:"+speed)
}
this.changeSpeed= function () {
var speed = currentSpeed+25;
document.write("<br>"+"加速:"+speed)
}
this.swerve= function () {
var speed = currentSpeed-35;
document.write("<br>"+"转向:"+speed);
}
this.stop = function () {
var speed = 0;
document.write("<br>"+"刹车:"+speed)
}
this.Turnofftheengine = function () {
var speed = currentSpeed-45;
document.write("<br>"+"关引擎:"+speed)
}
}
</script>