Skip to content

Commit

Permalink
Use let instead of var for counter variable in for loops
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Nov 18, 2020
1 parent 6d2b827 commit 8126ef2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/attribute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
function addAttribute (element: Array<HTMLElement>|HTMLElement, attribute:string, value:string) {
if (element instanceof Array) {
for (var i = 0; i < element.length; ++i) {
for (let i = 0; i < element.length; ++i) {
addAttribute(element[i], attribute, value)
}
return
Expand All @@ -18,7 +18,7 @@ function addAttribute (element: Array<HTMLElement>|HTMLElement, attribute:string
*/
function removeAttribute (element: Array<HTMLElement>|HTMLElement, attribute:string) {
if (element instanceof Array) {
for (var i = 0; i < element.length; ++i) {
for (let i = 0; i < element.length; ++i) {
removeAttribute(element[i], attribute)
}
return
Expand Down
4 changes: 2 additions & 2 deletions src/eventListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import store from './store'
*/
function addEventListener (element: Array<HTMLElement>|HTMLElement, eventName:string, callback: () => void) {
if (element instanceof Array) {
for (var i = 0; i < element.length; ++i) {
for (let i = 0; i < element.length; ++i) {
addEventListener(element[i], eventName, callback)
}
return
Expand All @@ -20,7 +20,7 @@ function addEventListener (element: Array<HTMLElement>|HTMLElement, eventName:st
*/
function removeEventListener (element: Array<HTMLElement>|HTMLElement, eventName: string) {
if (element instanceof Array) {
for (var i = 0; i < element.length; ++i) {
for (let i = 0; i < element.length; ++i) {
removeEventListener(element[i], eventName)
}
return
Expand Down

0 comments on commit 8126ef2

Please sign in to comment.