1、函数定义和使用
<script>
function sqrt(x) {
return x * x;
}
function other(f) {
var y = f(10);
return y;
}
var farr = new Array();
farr[0] = function(arg) { return arg + arg;};
farr[1] = function(arg) { return arg * arg;};
document.write(farr[0](10) + '<br/>');
document.write(farr[1](10));
document.write(other(sqrt));
</script>
sqrt.count = 0;
sqrt.getcount = function() {
return this.count;
}; // 附加函式
//sqrt();
document.write(sqrt.count, '<br/>');
document.write(sqrt.getcount());