TypeScript - String valueOf()



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
typescript_strings.htm
Advertisements