Changed “var” to “let” in DecimalToOctal.js (#256)

* Changed “var” to “let” in DecimalToOctal.js

Moved 1 liner code into 2 lines.

* Update Conversions/DecimalToOctal.js

Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>

Co-authored-by: vinayak <itssvinayak@gmail.com>
Co-authored-by: Tapajyoti Bose <44058757+ruppysuppy@users.noreply.github.com>
This commit is contained in:
Armend
2020-08-20 14:42:39 -04:00
committed by GitHub
parent 8e44a53b05
commit c1489ecbde

View File

@ -1,7 +1,8 @@
function decimalToOctal (num) {
var oct = 0; var c = 0
let oct = 0
let c = 0
while (num > 0) {
var r = num % 8
const r = num % 8
oct = oct + (r * Math.pow(10, c++))
num = Math.floor(num / 8) // basically /= 8 without remainder if any
}