Skip to content

Instantly share code, notes, and snippets.

@hectorlorenzo
hectorlorenzo / aocd1.js
Created December 1, 2017 17:58
Advent of code day 1
function sumConsecutive (number) {
var arrayOfNumbers = number.split('')
var sum = 0
var currentNumber = null
var nextNumber = null
var arrayLength = arrayOfNumbers.length
for (var i = arrayLength - 1; i >= 0; i--) {
currentNumber = arrayOfNumbers[i]
@hectorlorenzo
hectorlorenzo / aocd3.js
Created December 4, 2017 14:47
Solution to Advent of Code 3
function sum (x) {
var sum = 0;
while(x > 0) {
sum = sum + x;
x--;
}
return sum;
}