diff --git a/index.html b/index.html index ef273b7..e79742a 100755 --- a/index.html +++ b/index.html @@ -20,8 +20,8 @@

Loops Exercises

diff --git a/js/script.js b/js/script.js index c36bf4a..c7d8bf4 100755 --- a/js/script.js +++ b/js/script.js @@ -2,12 +2,24 @@ var display = document.getElementById("display"); -function yourFunctionName (){ - display.innerHTML = "hello"; +function combineArrays(arr1, arr2) { + + var arrays = arr1.map(function(el, i) { + return [el, arr2[i]]; + }) + display.innerHTML = [].concat.apply(arrays); } -function example(){ - var v = 3 +4; - - display.innerHTML = v; +function largestPossibleNumber(numArr) { + var splitArr = numArr.map(function(num) { + num = num+""; + return num.split(""); + }) + + splitArr.sort(function(a, b) { + return b[0] - a[0]; + }) + var flat = [].concat.apply([], splitArr); + display.innerHTML = flat.join(""); + } \ No newline at end of file