Favorites

JavaScript Object.prototype.toString() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Object.prototype.toString()
JavaScript Object Instance methodThis method is supported by all modern browsers.
Updated 28th November 2026

The toString() method returns a string representing an object. The default for plain objects is "[object Object]", but many types override it.

Description

The toString() method returns a string representation of an object. JavaScript calls it automatically when an object is converted to a string, such as in concatenation. Plain objects return "[object Object]", which is rarely useful; arrays, dates, numbers, functions and errors provide their own versions.

Calling Object.prototype.toString.call(value) gives a reliable type tag like "[object Date]". To display an object's contents, use JSON.stringify().

Classes can customize the tag reported by Object.prototype.toString() by defining a Symbol.toStringTag getter, which is how built-ins such as Map report "[object Map]". For logging, browsers' consoles show objects interactively, so console.log(obj) is usually more useful than converting it to a string.

Syntax

obj.toString()

Return Value

A string representing the object, by default "[object Type]".

Example

console.log({ a: 1 }.toString());
console.log('Value: ' + { a: 1 });
console.log(Object.prototype.toString.call([]));
console.log(Object.prototype.toString.call(new Date()));
console.log(JSON.stringify({ a: 1 }));

Browser Support

The following information will show you the current browser support for the Object.prototype.toString() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee