Javascript - String valueOf() method

The valueOf() method returns the primitive value of a String object.

Description

The valueOf() method returns the primitive value of a String object.

Syntax

string.valueOf()

Parameters

None

Return Value

A String, representing the primitive value of a string

Example

Return the primitive value of a string object:

Demo

var str = "Hello World!";
var res = str.valueOf();
console.log(res);

Result