81,092
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<title></title>
<script type="text/javascript">
var Adder = function(valueA , valueB) {
var newvalue = valueA + valueB;
this.value = newvalue;
this.result = function() {alert(this.value)};
};
var added = new Adder(5,6);
added.result;
</script>
</head>
<body>
</body>
</html>
<html>
<head>
<title></title>
<script type="text/javascript">
var Adder = function(valueA , valueB) {
var newvalue = valueA + valueB;
var object = new Object();
object.result = function() {alert(this.value)};
return object;
};
var added = new Adder(5,6);
added.result();
</script>
</head>
<body>
</body>
</html>
<html>
<head>
<title></title>
<script type="text/javascript">
var Adder = function(valueA , valueB) {
this.newvalue = valueA + valueB;
var object = new Object();
var _self = this;
object.result = function() {alert(_self.newvalue)};
return object;
};
var added = new Adder(5,6);
added.result();
</script>
</head>
<body>
</body>
</html>