太原web前端开发招聘 |
游戏前端开发 招聘 |
新浪前端开发招聘 |
javascript 代码
/*
* 1.
*/
function Balance(consume) {
this.consume = consume
}
Balance.cash = 10000
Balance.prototype.count = function() {
return Balance.cash – this.consume
}
var b = new Balance(2390)
console.log(‘余额为: $’ + b.count())
javascript 代码
/*
* 2.
*/
var Balance = new Object()
Balance.cash = 10000
Balance.count = function(consume) {
return ‘余额为: $’ + (this.cash – consume)
}
console.log(Balance.count(100))
javascript 代码
/*
* 3.
*/
var Balance = function() {
var blc = new Object()
blc.cash = 10000
blc.count = function(consume) {
return ‘余额为: $’ + (this.cash – consume)
}
return blc
}
var b = new Balance()
console.log(b.count(9999))
html 代码
/*
* 4.
*/
var Balance = new Function(
“this.cash = 10000; this.count = function(consume){ return ‘余额为: $’+(this.cash – consume); }”,
)
console.log(new Balance().count(2000))
javascript 代码
/*
* 5.(最常用)
*/
var Balance = {
cash: 10000,
count: function(consume) {
return ‘余额为: $’ + (this.cash – consume)
},
}
console.log(Balance.count(3750))
web前端开发校园招聘 |
web前端移动开发郑州招聘 |
天津织梦前端开发招聘 |
评论前必须登录!
注册