Skip to content

Commit

Permalink
var -> let
Browse files Browse the repository at this point in the history
  • Loading branch information
gnehs committed Nov 9, 2021
1 parent 3735dcd commit e15eb8e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions dataModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,15 +467,15 @@ router.get("/searchLyrics/", async (req, res) => {
s1 = s1.toLowerCase();
s2 = s2.toLowerCase();

var costs = new Array();
let costs = new Array();
for (var i = 0; i <= s1.length; i++) {
var lastValue = i;
for (var j = 0; j <= s2.length; j++) {
let lastValue = i;
for (let j = 0; j <= s2.length; j++) {
if (i == 0)
costs[j] = j;
else {
if (j > 0) {
var newValue = costs[j - 1];
let newValue = costs[j - 1];
if (s1.charAt(i - 1) != s2.charAt(j - 1))
newValue = Math.min(Math.min(newValue, lastValue), costs[j]) + 1;
costs[j - 1] = lastValue;
Expand All @@ -488,13 +488,13 @@ router.get("/searchLyrics/", async (req, res) => {
}
return costs[s2.length];
}
var longer = s1;
var shorter = s2;
let longer = s1;
let shorter = s2;
if (s1.length < s2.length) {
longer = s2;
shorter = s1;
}
var longerLength = longer.length;
let longerLength = longer.length;
if (longerLength == 0) {
return 1.0;
}
Expand Down

0 comments on commit e15eb8e

Please sign in to comment.