Where object can be any object and this method will convert that object value to a string value. Let us understand use of toString() method with a very simple example. Here we have explained this by converting a Date object into the String object.
Description of code :
In the above line of code we have first taken the current date object by creating a new date object reference using "new Date()". After this we have converted this to the string. Result of new Date().toString() method is a date converted into the string format and which is shown in an alert message box.
Click on "Convert current date to String" to call the function convertToString()
You can also download full source code from the following link as given :
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial