Skip to content

Commit e3162dc

Browse files
authoredJan 29, 2021
Use Array destructring to swap variables (#13)
Use Array destructring to swap variables
2 parents 512539b + 252a7ae commit e3162dc

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed
 

‎mod.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ const myers_x = (b: string, a: string) => {
113113

114114
const distance = (a: string, b: string): number => {
115115
if (a.length < b.length) {
116-
const tmp = b;
117-
b = a;
118-
a = tmp;
116+
[b, a] = [a, b];
119117
}
120118
if (b.length === 0) {
121119
return a.length;

0 commit comments

Comments
 (0)
Please sign in to comment.