diff --git a/html/tasks/extra/task1/script.js b/html/tasks/extra/task1/script.js index 38d225f..aabba11 100644 --- a/html/tasks/extra/task1/script.js +++ b/html/tasks/extra/task1/script.js @@ -5,20 +5,20 @@ eller så må vi ta vekk det andre, men vi står fortsatt alltid igjen med ett a */ function almostIncreasingSequence(sequence) { - let decreaseCounter=0; - for (elements in sequence){ - if (sequence[elements] > sequence[parseInt(elements)+1]) { - decreaseCounter++; - if (decreaseCounter > 1) { - return false; - } - } + let decreaseCounter = 0; + for (elements in sequence){ + if (sequence[elements] > sequence[parseInt(elements) + 1]) { + decreaseCounter++; + if (decreaseCounter > 1) { + return false; + } } - return true; + } + return true; } /* Test */ -console.log("[1,3,2,1]" + " -> " + almostIncreasingSequence([1,3,2,1])); -console.log("[1,3,2]" + " -> " + almostIncreasingSequence([1,3,2])); -console.log("[1,3,2,4,5,6,8]" + " -> " + almostIncreasingSequence([1,3,2,4,5,6,8])); -console.log("[1,3,2,4,5,6,8,2]" + " -> " + almostIncreasingSequence([1,3,2,4,5,6,8,2])); \ No newline at end of file +console.log(`[1,3,2,1] -> ${almostIncreasingSequence([1,3,2,1])}`); +console.log(`[1,3,2] -> " + ${almostIncreasingSequence([1,3,2])}`); +console.log(`[1,3,2,4,5,6,8] -> " + ${almostIncreasingSequence([1,3,2,4,5,6,8])}`); +console.log(`[1,3,2,4,5,6,8,2] -> " + ${almostIncreasingSequence([1,3,2,4,5,6,8,2])}`); \ No newline at end of file diff --git a/html/tasks/template/OppgaveMal/oppgave.html b/html/tasks/template/OppgaveMal/oppgave.html index 1e08c79..60367c8 100755 --- a/html/tasks/template/OppgaveMal/oppgave.html +++ b/html/tasks/template/OppgaveMal/oppgave.html @@ -1,20 +1,19 @@ -
- - - -