Skip to content

Commit d2f1fd4

Browse files
committed
Update a few more vars to const in js/ts snippets
Fixes microsoft#35322
1 parent ebffb73 commit d2f1fd4

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

extensions/javascript/snippets/javascript.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"For-Each Loop": {
2626
"prefix": "foreach",
2727
"body": [
28-
"${1:array}.forEach((${2:element}) => {",
28+
"${1:array}.forEach(${2:element} => {",
2929
"\t$0",
3030
"});"
3131
],
@@ -34,7 +34,7 @@
3434
"For-In Loop": {
3535
"prefix": "forin",
3636
"body": [
37-
"for (let ${1:key} in ${2:object}) {",
37+
"for (const ${1:key} in ${2:object}) {",
3838
"\tif (${2:object}.hasOwnProperty(${1:key})) {",
3939
"\t\tconst ${3:element} = ${2:object}[${1:key}];",
4040
"\t\t$0",

extensions/javascript/snippets/javascriptreact.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"For-Each Loop": {
2626
"prefix": "foreach",
2727
"body": [
28-
"${1:array}.forEach((${2:element}) => {",
28+
"${1:array}.forEach(${2:element} => {",
2929
"\t$0",
3030
"});"
3131
],
@@ -34,7 +34,7 @@
3434
"For-In Loop": {
3535
"prefix": "forin",
3636
"body": [
37-
"for (let ${1:key} in ${2:object}) {",
37+
"for (const ${1:key} in ${2:object}) {",
3838
"\tif (${2:object}.hasOwnProperty(${1:key})) {",
3939
"\t\tconst ${3:element} = ${2:object}[${1:key}];",
4040
"\t\t$0",

extensions/typescript/snippets/typescript.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
"prefix": "for",
138138
"body": [
139139
"for (let ${1:index} = 0; ${1:index} < ${2:array}.length; ${1:index}++) {",
140-
"\tvar ${3:element} = ${2:array}[${1:index}];",
140+
"\tconst ${3:element} = ${2:array}[${1:index}];",
141141
"\t$0",
142142
"}"
143143
],
@@ -155,9 +155,9 @@
155155
"For-In Loop": {
156156
"prefix": "forin",
157157
"body": [
158-
"for (var ${1:key} in ${2:object}) {",
158+
"for (const ${1:key} in ${2:object}) {",
159159
"\tif (${2:object}.hasOwnProperty(${1:key})) {",
160-
"\t\tvar ${3:element} = ${2:object}[${1:key}];",
160+
"\t\tconst ${3:element} = ${2:object}[${1:key}];",
161161
"\t\t$0",
162162
"\t}",
163163
"}"

extensions/typescript/snippets/typescriptreact.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
"prefix": "for",
138138
"body": [
139139
"for (let ${1:index} = 0; ${1:index} < ${2:array}.length; ${1:index}++) {",
140-
"\tvar ${3:element} = ${2:array}[${1:index}];",
140+
"\tconst ${3:element} = ${2:array}[${1:index}];",
141141
"\t$0",
142142
"}"
143143
],
@@ -155,9 +155,9 @@
155155
"For-In Loop": {
156156
"prefix": "forin",
157157
"body": [
158-
"for (var ${1:key} in ${2:object}) {",
158+
"for (const ${1:key} in ${2:object}) {",
159159
"\tif (${2:object}.hasOwnProperty(${1:key})) {",
160-
"\t\tvar ${3:element} = ${2:object}[${1:key}];",
160+
"\t\tconst ${3:element} = ${2:object}[${1:key}];",
161161
"\t\t$0",
162162
"\t}",
163163
"}"

0 commit comments

Comments
 (0)