TypeScript – String valueOf()

value of a String

This method returns the primitive value of a String object.

Syntax

string.valueOf( )

Return Value

Returns the primitive value of a String object.

Example

var str = new String("Hello world"); 
console.log(str.valueOf( ));

On compiling, it will generate the same code in JavaScript.

Its output is as follows −

Hello world

Previous Page:-Click Here

Leave a Reply