Skip to content

Commit 026301e

Browse files
committed
Update count.js implementation
1 parent eac7d73 commit 026301e

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

Sprint-3/2-practice-tdd/count.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1-
function countChar(stringOfCharacters, findCharacter) {
2-
let count = 0;
3-
for (let i = 0; i < stringOfCharacters.length; i++) {
4-
if (stringOfCharacters[i] === findCharacter) {
5-
count++;
6-
}
7-
}
1+
// function countChar(stringOfCharacters, findCharacter) {
2+
// let count = 0;
3+
// for (let i = 0; i < stringOfCharacters.length; i++) {
4+
// if (stringOfCharacters[i] === findCharacter) {
5+
// count++;
6+
// }
7+
// }
8+
9+
// return count;
10+
// }
11+
// module.exports = countChar;
12+
let numbers=[1,2,3,4,5,6,1,2,3,4,5,6]
13+
let idxArray=[];
14+
numbers.find((el,ix,numbers)=>{
15+
if (el===3){
16+
17+
idxArray.push(ix);}
18+
})
19+
console.log(idxArray);
820

9-
return count;
10-
}
11-
module.exports = countChar;

0 commit comments

Comments
 (0)