Created
March 29, 2021 15:00
-
-
Save naufaldi/2eb6caef5e81a05597ee97e5eda1ec83 to your computer and use it in GitHub Desktop.
Array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let angka = 641573; | |
let angkaString = angka.toString(); | |
let angkaArray = Array.from(angkaString); | |
let tempArray = []; | |
for (let i = 0; i < angkaArray.length; i++) { | |
console.log('Angka Join ', angkaArray[i] + angkaArray[i + 1]); | |
let tempAngka = angkaArray[i] + angkaArray[i + 1]; | |
tempArray.push(tempAngka); | |
console.log('temp array ', tempArray); | |
} | |
//1. convert number to string so that it can be looped | |
//2. ?? how to compare between each iteration?? | |
//3. if 1st iteration < 2nd, 2nd, then go on | |
//4. if 2nd iteration > 3rd, 2nd. then go on | |
//5. former iteration's result should be brought up and locked | |
// before being compared with an if function with the latter one | |
// yeah but how??? | |
// * put the result of the first iteration into a variable | |
// * that variable should also be put before r (second iteration) | |
// console.log(r); | |
console.log('Angka string ', tempArray); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment