Skip to content

Commit 5df2d5e

Browse files
committed
Mismatch
1 parent 12233c3 commit 5df2d5e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Programs/Array/mismatch.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
/*
3+
check string compare it to array that Hallo is differnt from Hello so return e
4+
*/
5+
let arr = ["hi", "Hello"];
6+
let str = "Hallo";
7+
8+
for (let word of arr) {
9+
if (word.length === str.length) {
10+
for (let i = 0; i < word.length; i++) {
11+
if (word[i] !== str[i]) {
12+
console.log(word[i]); // This is the mismatching character from the array
13+
break;
14+
}
15+
}
16+
}
17+
}
18+
19+

0 commit comments

Comments
 (0)