Methods in JavaScript

toString() is an example of a method in JavaScript. It’s a Boolean method and what it does is convert Booleans to Strings. Take a look at the following example:

false.toString();  // Returns “false”.

Please pay attention to have the method has been used here and that’s how methods are used in JavaScript overall. First you have the keyword false then you have a dot and then the method has been added to it. The dot actually shows that toString() is a method.