JavaScript Function call()

The JavaScript Function call() method calls a function containing this value and an argument list.

Syntax:

function.call(thisArg, arguments)

Parameters: thisArg: It is used as this keyword for the call to a function. arguments: It represents the function parameters.

Return: Result of the invoking function.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
function Jewel(Carat,Stone)
{
this.Carat = Carat;
this.Stone = Stone;
}
function Jewelname(Carat,Stone) {
Jewel.call(this,Carat,Stone);
}
document.writeln(new Jewelname(22,"GOLD").Stone);
</script>
</body>
</html>
Please follow and like us:
Content Protection by DMCA.com