자바스크립트 호출() 메소드는 다른 객체를 첫 번째 인수로 사용하여 함수를 호출하는 데 사용됩니다.
예
다음 코드를 실행하여 JavaScript에서 call() 메서드를 구현하는 방법을 배울 수 있습니다.
<html>
<head>
<script>
var person = {
Name:"John",
Department: "Finance",
fullName: function() {
return this.Name + " is from " + this.Department + " Department";
}
}
var myObject = {
Name: "Amit",
Department: "Marketing",
}
x = person.fullName.call(myObject);
document.write(x);
</script>
</head>
<body>
</body>
</html>