Last active
August 28, 2018 15:00
-
-
Save codingedgar/583368bce1614debf20775c38a231fc1 to your computer and use it in GitHub Desktop.
until transducer: for_fouble
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
function double_every_element(numbers: number[]) { | |
let result: number[] = []; | |
for (let i = 0; i < numbers.length; i++) { | |
result.push(2 * numbers[i]) | |
} | |
return result; | |
} | |
test('double numbers in list using for statement', () => { | |
expect(double_every_element([1, 2, 3])).toEqual([2, 4, 6]) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment