Purpose
The purpose of this script is to convert a numeric value into a string without using .toString() or an array. Over the decades of programming I've never needed to solve such a task but I was asked about it so I provide one approach (using javascript) below.
Convert Numeric Value to String Question (and answer):
Given the numeric value 12345, convert that value to a string without using a .toString() conversion function or array.
For reference, the value returned should be: "12345"
Function Logic Output:
Full Working Code You Can Copy:
<html>
<head>
<script language="javascript" type="text/javascript">
function convertNumberToString(sequence) {
var emptyString = "";
var result = emptyString.concat(sequence);
return(result);
}
</script>
</head>
<body onload='javascript:document.getElementById("output").value = convertNumberToString(12345);'>
Given the numeric value 12345, convert that value to a string without using a .toString() conversion function or array.<br />
<span style="font-size:9pt">For reference, the value returned should be: "12345"</span>
<br /><br />
<strong>Function Logic Output:</strong><br />
<textarea name="output" id="output" rows="4" cols="30"></textarea>
</body>
</html>