From c19d3a850620e3a68d365f7758aef8276910c8b0 Mon Sep 17 00:00:00 2001 From: "Christian C. Salvado" Date: Wed, 12 Jun 2019 11:15:54 -0600 Subject: [PATCH] fix: simplify the maxDate function implementation --- snippets/maxDate.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/maxDate.md b/snippets/maxDate.md index ffa784528..4b66adb94 100644 --- a/snippets/maxDate.md +++ b/snippets/maxDate.md @@ -2,10 +2,10 @@ Returns the maximum of the given dates. -Use `Math.max.apply()` to find the maximum date value, `new Date()` to convert it to a `Date` object. +Use the ES6 spread syntax with `Math.max` to find the maximum date value, `new Date()` to convert it to a `Date` object. ```js -const maxDate = (...dates) => new Date(Math.max.apply(null, ...dates)); +const maxDate = dates => new Date(Math.max(...dates)); ``` ```js