From e1631e5415ec202c3a3be78854b0b787e950a454 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Sun, 10 Dec 2023 16:02:45 +0100 Subject: [PATCH] save result in variable --- Day10/Part1.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Day10/Part1.js b/Day10/Part1.js index b4edf1f..99ff2eb 100644 --- a/Day10/Part1.js +++ b/Day10/Part1.js @@ -79,7 +79,8 @@ while (open.length > 0) { open.push(next); } } -console.log(closed.sort((a, b) => b.distance - a.distance)[0].distance); +const furthest = closed.sort((a, b) => b.distance - a.distance)[0]; +console.log(furthest.distance); const t1 = performance.now(); console.log(`Runtime: ${t1 - t0}ms`);