Created
June 16, 2017 17:05
-
-
Save diegodfsd/e489a4e74876d25c385598f81b86ad2c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 items = [4, 5, 80]; | |
let results = []; | |
items.forEach(function(x) { | |
let number = x; | |
let result = 0; | |
let a = 0; | |
let b = 0; | |
result = (number / 4); | |
a = Math.round(result); | |
b = result > 1? Math.round(result % 4) : 0; | |
results.push( ((2*a) + b) ); | |
}); | |
console.log(results); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment