Knowledge Walls
Laya
Hyderabad, Andhra Pradesh, India
String.prototype.valueOf() Method in String Class of Javascript Syntax with Examples
2129 Views
Usage 
String.prototype.valueOf() Method is used to display value of a String object as a string data type.

Example
var str = new String();
  1. str is String object. <typeof str> returns the object string.
  2. str.valueOf() returns string datatype. <typeof str.valueOf()> returns the string datatype value.
Syntax 
StringObject.valueOf()
 
Example
var x = new String('Hello world');

document.write(x.valueOf());
document.write(typeof x);
document.write(typeof x.valueOf());
Output 
Hello world
object
string
Best Lessons of "Javascript Syntax with Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details