10.07.2017 Views

javascript_tutorial

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Javascript<br />

this.title = title;<br />

this.publisher = publisher;<br />

this.price = price;<br />

}<br />

var newBook = new book("Perl","Leo Inc",200);<br />

document.write("newBook.toSource() is : "+ newBook.toSource());<br />

<br />

<br />

<br />

Output<br />

({title:"Perl", publisher:"Leo Inc", price:200})<br />

toString ()<br />

This method returns a string of either "true" or "false" depending upon the value<br />

of the object.<br />

Syntax<br />

Its syntax is as follows:<br />

boolean.toString()<br />

Return Value<br />

Returns a string representing the specified Boolean object.<br />

Example<br />

Try the following example.<br />

<br />

<br />

JavaScript toString() Method<br />

<br />

<br />

<br />

var flag = new Boolean(false);<br />

document.write( "flag.toString is : " + flag.toString() );<br />

133

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!