UNPKG
phpjs
Version:
latest (1.3.2)
1.3.2
1.2.2
1.1.2
1.0.2
1.0.1
1.0.0
0.0.1
php.js offers community built php functions in javascript
phpjs.org
kvz/phpjs
phpjs
/
functions
/
math
/
octdec.js
10 lines
(9 loc)
•
270 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
function
octdec
(
oct_string
) {
// discuss at: http://phpjs.org/functions/octdec/
// original by: Philippe Baumann
// example 1: octdec('77');
// returns 1: 63
oct_string = (oct_string +
''
) .
replace
(
/[^0-7]/gi
,
''
);
return
parseInt
(oct_string,
8
); }