VBScript Oct Function

Definition and Usage

The Oct function can return a string representing the octal value of the specified number.

Note:If number If the parameter is not an integer, it will be rounded to the nearest integer before the operation.

Syntax

Oct(number)
Parameter Description
number

required. Any valid expression.

If number Is:

  • Null - then the Oct function will return Null.
  • Empty - then the Oct function will return zero (0).
  • Other numbers - then the Oct function will return up to 11 hexadecimal characters.

Example

document.write(Oct(3))
document.write(Oct(5))
document.write(Oct(9))
document.write(Oct(10))
document.write(Oct(11))
document.write(Oct(12))
document.write(Oct(400))
document.write(Oct(459))
document.write(Oct(460))

Output separately:

3
5
11
12
13
14
620
713
714

Try It Yourself