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
class Dice { | |
topSideval; | |
getTopSideVal() { | |
return this.topSideval | |
} | |
roll() { | |
this.topSideval = Math.floor(Math.random() * 6) + 1 | |
return this; |
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
#!/bin/bash | |
PARAMS=('-m 6 -q 70 -mt -af -progress') | |
if [ $# -ne 0 ]; then | |
PARAMS=$@; | |
fi | |
cd $(pwd) |
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
const arr1 = [1, 7, 13, 15]; | |
const arr2 = [1, 4, 5, 9, 20]; | |
const merge = (arr1, arr2) => { | |
let merged = []; | |
let index1 = 0; | |
let index2 = 0; | |
let current = 0; | |
while(current < (arr1.length + arr2.length)) { |
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
const array = [4, 2, 1, 5]; | |
const maxDiff = array => { | |
let result = 0; | |
for(let i = 0; i < array.length; i++) { | |
for(let j = i+1; j < array.length; j++) { | |
if(array[i] < array[j] && i < j) { | |
result = array[j] - array[i] |
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
export const toRupiah = price => { | |
return Math.abs(price) | |
.toString() | |
.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1.'); | |
}; | |
/** | |
* | |
* example return |