Skip to content

Commit c1489ec

Browse files
Vodkacannonitsvinayakruppysuppy
authored
Changed “var” to “let” in DecimalToOctal.js (TheAlgorithms#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>
1 parent 8e44a53 commit c1489ec

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Conversions/DecimalToOctal.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
function decimalToOctal (num) {
2-
var oct = 0; var c = 0
2+
let oct = 0
3+
let c = 0
34
while (num > 0) {
4-
var r = num % 8
5+
const r = num % 8
56
oct = oct + (r * Math.pow(10, c++))
67
num = Math.floor(num / 8) // basically /= 8 without remainder if any
78
}

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