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 />

Method<br />

toSource()<br />

toString()<br />

valueOf()<br />

Description<br />

Returns a string containing the source of the Boolean object;<br />

you can use this string to create an equivalent object.<br />

Returns a string of either "true" or "false" depending upon the<br />

value of the object.<br />

Returns the primitive value of the Boolean object.<br />

In the following sections, we will have a few examples to demonstrate the usage<br />

of the Boolean methods.<br />

toSource ()<br />

Javascript boolean toSource() method returns a string representing the source<br />

code of the object.<br />

Note: This method is not compatible with all the browsers.<br />

Syntax<br />

Its syntax is as follows:<br />

boolean.toSource()<br />

Return Value<br />

Returns a string representing the source code of the object.<br />

Example<br />

Try the following example.<br />

<br />

<br />

JavaScript toSource() Method<br />

<br />

<br />

<br />

function book(title, publisher, price)<br />

{<br />

132

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

Saved successfully!

Ooh no, something went wrong!