Skip to content

Instantly share code, notes, and snippets.

@YounglanHong
Created June 14, 2020 12:19
Show Gist options
  • Save YounglanHong/73f1d193c2b49cfe0b6b88010d36f07f to your computer and use it in GitHub Desktop.
Save YounglanHong/73f1d193c2b49cfe0b6b88010d36f07f to your computer and use it in GitHub Desktop.
//2️⃣ Reduce
const seconds = timeNodes
.map((node) => node.dataset.time)
.reduce((acc, time) => {
const [mins, secs] = time.split(":").map(parseFloat);
time = mins * 60 + secs;
return acc + time;
}, 0);
// 2️⃣ Reduce => 숫자(누적 계산 값) 반환
// console.log(seconds); // 17938
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment