function callerDemo() {
if (callerDemo.caller) {
var a= callerDemo.caller.arguments[0];
alert(a);
} else {
alert("this is a top function");
}
}
function handleCaller() {
callerDemo();
}
if (callerDemo.caller) {
var a= callerDemo.caller.arguments[0];
alert(a);
} else {
alert("this is a top function");
}
}
function handleCaller() {
callerDemo();
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head><body>
<script type="text/javascript">
function Person() {
alert(Person.caller);
}/*function A() {
new Person();
}*/
function A(a) {
this.a = a;
}
A.prototype.sayHi = function() {
alert(this.a);
}
var person = new Person();
var as = new A(person);
as.sayHi();
</script>
</body>
</html>