From 7a6562e44ef90cfb4b18803c8585e9673fa84c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Matte?= Date: Thu, 28 Sep 2023 22:51:48 -0400 Subject: [PATCH] Change declaration variable --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index e425a8a..4dc4755 100644 --- a/index.js +++ b/index.js @@ -2,8 +2,8 @@ const sortby = (properties) => (a, b) => { // if items is {prop1:value1, prop2:value2} // then sort(['prop1', 'desc', 'prop2']) // will sort by prop1 desc and prop2 - for (var i = 0; i < properties.length; i++) { - var property = properties[i] + for (let i = 0; i < properties.length; i++) { + const property = properties[i] let order = -1 if (i + 1 < properties.length && properties[i + 1] === 'desc') {