I m looking for a way to display an octal value as its string representation.
IE,
stringified(0755)==='0755'
Where stringified
is an hypothetic function doing the desired job.
My attempts to play with parseInt(octal, <base>)
were not successful, i definitely miss something.
thanks!
The toString method for numbers has a radix parameter.
0755.toString(8)
Will return:
"755"
You can add the zero manually. For an example stringified
function:
function stringified( number ) {
return "0" + number.toString(8);
}