---
title: "Calling Objects Method in JavaScript"  
description: "It seems that methods and function are same and technically they are in JavaScript, because all functions belong to some object but those methods whic"  
author: "Vijay Shukla"  
published: 2012-12-03  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/397/calling-objects-method-in-javascript  
category: "javascript"  
tags: ["javascript"]  
reading_time: 2 minutes  

---

# Calling Objects Method in JavaScript

##### Introduction:

In this [article](https://www.mindstick.com/articles/95867/are-you-looking-for-500-credit-score-mortgage-lenders-houston-continue-reading-this-article) I am going to explain about calling objects [Methods](https://www.mindstick.com/articles/13060/runny-nose-remedy-methods-that-work-best) in [JavaScript](https://www.mindstick.com/articles/874/how-to-create-watermark-text-for-textbox-by-using-javascript).

First we will decide what is the [difference between method](https://www.mindstick.com/interview/2444/difference-between-method-and-selector) and [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server):

It seems that methods and function are same and technically they are in JavaScript, because all [functions](https://www.mindstick.com/forum/160140/explain-the-role-of-functions-as-a-service-faas-in-serverless-computing) belong to some object but those methods which are called without an object (Dot) prefix will be [considered as](https://www.mindstick.com/forum/156093/what-is-considered-as-more-significant-creating-content-or-building-backlinks) functions because they are part of global namespace. Global functions does not require dot prefix and are owned by the [window object](https://www.mindstick.com/forum/161284/what-are-the-key-properties-of-the-javascript-window-object). We can see that isNaN(), alert() and eval () are Global functions, they can be directly called, but we can also access it with window object for eg. window.alert() will also work same as alert() works.

##### Function Call () and Apply ():-

The above function [named as](https://answers.mindstick.com/qa/62213/name-the-cricketer-who-was-named-as-the-player-of-the-tournament-in-cricket-world-cup-2019) Call () and Apply () allows an object to use other methods object. This save us from having duplicates methods in several objects.

##### Syntax for using Call () and Apply ():

Function.call (thisArg[, arg1[, arg2[, arg3[,…]]]])

Function.apply(thisArg[, argArray])

There are scenarios when we will be using call and apply functions; call function is best suited when we know the argument in advance. On the other hand apply function is used for methods when we do not know the argument and argument list can vary.

---

Original Source: https://www.mindstick.com/blog/397/calling-objects-method-in-javascript

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
