toString() in javascript using strings
toString() in javascript using strings
<!DOCTYPE html>
<html>
<head>
<title>Test page</title>
<script type="text/javascript">
/* toString will convert any data type of data into string type*/
var a=50;
var newie = a.toString();
console.log(newie + 20);
/* Output here will be 5020 instead of 70 because
newie is a string and not a number */
</script>
</head>
<body>
<h1></h1>
</body>
</html>
Comments
Post a Comment
I WOULD APPRECIATE IF YOU LEAVE A COMMENT OR YOUR FEEDBACK HERE !!!