adventofcode/2021/01/first.js

9 lines
234 B
JavaScript
Raw Normal View History

2023-11-30 22:36:04 +01:00
import fs from 'fs'
let input = fs.readFileSync('numbers',{encoding:"utf8"}).split('\n')
let result = 0
for (let i = 1; i < input.length; i++) {
if (Number(input[i]) >= Number(input[i - 1]))
result++
}
console.log(result)