Access caller from arguments in JavaScript

Description

The following code shows how to access caller from arguments.

Example


<!-- w w  w .j  av  a2s .  co m-->
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function outer(){
inner();
}

function inner(){
document.writeln(arguments.callee.caller);

}
outer();
inner();
</script>
</head>
<body>
</body>
</html>

Click to view the demo

The code above generates the following result.

Access caller from arguments in JavaScript