Advent of code Day1 Question 1

Answer for Day-1 Question 1 for Advent of code.

This is done from Google chrome console itself.

Here $0 is the element in the HTML.

var list=$0.innerHTML.split("\n");
var result=list.reduce(function(acc,currentValue){

return acc+(parseInt(currentValue)?parseInt(currentValue):0);
},0)