Skip to content

Commit 6cd03db

Browse files
committed
Added the standard javascript style
1 parent 446f88b commit 6cd03db

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Conversions/OctToDecimal.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
function octalToDecimal (num) {
2-
let dec = 0
3-
let base = 1
4-
while (num > 0) {
5-
const r = num % 10
6-
num = Math.floor(num / 10)
7-
dec = dec + (r * base)
8-
base = base * 8
9-
}
10-
return dec
2+
let dec = 0
3+
let base = 1
4+
while (num > 0) {
5+
const r = num % 10
6+
num = Math.floor(num / 10)
7+
dec = dec + (r * base)
8+
base = base * 8
119
}
10+
return dec
11+
}
1212

1313
// test cases
1414
console.log(octalToDecimal(56) === 46)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy