I've got this statement in javascript:
<script>
alert((444).toString(16));
</script>
Why is the output 1bc ? I tried in .net it gives 16, i don't understand can someone help me ?
I've got this statement in javascript:
<script>
alert((444).toString(16));
</script>
Why is the output 1bc ? I tried in .net it gives 16, i don't understand can someone help me ?
The output 1bc is 444 in base 16 (hexidecimal). In other words, the Number.toString method in JavaScript takes an optional base (radix) for the output conversion. In contrast, C#'s Int32.ToString method takes a format string.
If you want format strings in JavaScript, you can look at the answers for the question JavaScript equivalent to printf/string.format (the answer I linked to suggests a JS library providing an sprintf function).