JavaScript and JQuery Essentials Trainin... (44 Blogs) Become a Certified Professional
AWS Global Infrastructure

Front End Web Development

Topics Covered
  • AngularJS (18 Blogs)
  • jQuery UI Development (1 Blogs)
  • The Complete WebDeveloper (34 Blogs)
  • ReactJS (7 Blogs)


myMock Interview Service for Real Tech Jobs


What are JavaScript Methods and How to use them?

Published on Sep 04,2019 35 Views
5 / 21 Blog from JavaScript


myMock Interview Service for Real Tech Jobs


myMock Interview Service for Real Tech Jobs

  • Mock interview in latest tech domains i.e JAVA, AI, DEVOPS,etc
  • Get interviewed by leading tech experts
  • Real time assessment report and video recording

JavaScript objects are collections of key or value pairs. The values consist of properties and methods. Also, it contains other JavaScript data types, such as strings, numbers, and Booleans. In this article, we will discuss about the different JavaScript methods in the following sequence:

What are JavaScript Methods?

JavaScript methods are actions that can be performed on objects. A JavaScript method is a property that contains a function definition. For example:









function() {return this.FirstName + ” ” + this.LastName;}

These methods are nothing but functions stored as object properties. Now let’s see how you can access these object methods in JavaScript.

How to access object Methods?

You can access the object methods using the following syntax:


Here, you have to describe the FullName() as a method of the Person object, and FullName as a property. The fullName property works as a function when it is invoked with (). Here is an example of how to accesses the FullName() method of a person object:

Name = person.FullName();

This is how you can access the object method. Now, there are different types of Methods. So, we will discuss these methods in detail.

Different Types of JavaScript Methods

The different types of JavaScript Methods that are available in global Object constructor are:

  • Object.create()
  • Object.keys()
  • Object.freeze()
  • Object.values()


You can create object with Object.create() function. This has an additional flexibility that lets you choose the prototype of your new object.

let createObj = Object.create(obj);
console.log(createObj); //{} = "Danny";

In the above example, obj is the prototype from which createdObj is created. Also, it can use the properties of the prototype due to inheritance. Thus, you can use speak() method without declaring that in createdObj.


The object.keys function is used to pick only keys or property labels of objects and returns an array.

let keys = Object.keys(person);
// [ 'name', 'age' ]


The freeze function is used to freeze the object for any changes in key or values. It doesn’t throw any error unless you are in strict mode. But there will be no effect of value change on your object.

let frozenObject = Object.freeze(person); = "Rachel";


This function is used to select only values of objects and returns an array in the following way:

let values = Object.values(person);

These are some of the different types of Methods. With this, we have come to the end of our article. I hope you understood the different types of JavaScript methods and how they are used.

Now that you know about Methods in JavaScript, check out the Web Development Certification Training by Edureka. Web Development Certification Training will help you learn how to create impressive websites using HTML5, CSS3, Twitter Bootstrap 3, jQuery and Google APIs and deploy it to Amazon Simple Storage Service(S3). 

Got a question for us? Please mention it in the comments section of “JavaScript Methods” and we will get back to you.


Browse Categories

Subscribe to our Newsletter, and get personalized recommendations.