From 39e0e475e383ad7df4870982495dbea6fca63ce8 Mon Sep 17 00:00:00 2001 From: Michael Kreil Date: Sat, 19 Mar 2022 14:49:32 +0100 Subject: [PATCH] use let instead of var to define loop variables --- snippets/language-javascript.cson | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snippets/language-javascript.cson b/snippets/language-javascript.cson index 24fdbb61..0f19b1b9 100644 --- a/snippets/language-javascript.cson +++ b/snippets/language-javascript.cson @@ -28,13 +28,13 @@ 'body': 'else if (${1:true}) {\n\t$2\n}' 'for': 'prefix' : 'for' - 'body' : 'for (var ${2:i} = 0; ${2:i} < ${1:array}.length; ${2:i}++) {\n\t${1:array}[${2:i}]$3\n}' + 'body' : 'for (let ${2:i} = 0; ${2:i} < ${1:array}.length; ${2:i}++) {\n\t${1:array}[${2:i}]$3\n}' 'for in': 'prefix': 'forin' - 'body': 'for (var ${1:variable} in ${2:object}) {\n\t${3:if (${2:object}.hasOwnProperty(${1:variable})) {\n\t\t$4\n\t\\}}\n}' + 'body': 'for (let ${1:variable} in ${2:object}) {\n\t${3:if (${2:object}.hasOwnProperty(${1:variable})) {\n\t\t$4\n\t\\}}\n}' 'for of': 'prefix': 'forof' - 'body': 'for (var ${1:variable} of ${2:iterable}) {\n\t$3\n}' + 'body': 'for (let ${1:variable} of ${2:iterable}) {\n\t$3\n}' 'forEach': 'prefix' : 'foreach' 'body' : 'forEach((${1:item}, ${2:i}) => {\n\t$3\n});\n'