How to use String in JavaScript
This article describe about String() Function in JavaScript.
String() Function in JavaScript
It is used to convert object to string value.
Syntax
Parameter |
Description |
object |
Required. JavaScript object. |
Example
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
var t1 = new Boolean(1);
var t2 = new Boolean(0);
var t3 = new Boolean(true);
var t4 = new Boolean(false);
var t5 = new Date();
var t6 = new String("777 888");
var t7 = 54321;
document.write(String(t1) + "<br />");
document.write(String(t2) + "<br />");
document.write(String(t3) + "<br />");
document.write(String(t4) + "<br />");
document.write(String(t5) + "<br />");
document.write(String(t6) + "<br />");
document.write(String(t7) + "<br />");
</script>
</body>
</html>
|
Output
You may also want to read these related articles Click here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here