html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!-- Created for Alessandro Palazzolo's question:
https://www.sololearn.com/Discuss/1569670
Variable's strings count
How can i count how many times a letter repeats herself between many variables?
var match3 = "V";
var match2 = "S";
var match3 = "v";
then how can I put an If statement that processes something if there are two "v" and one "s"?
-->
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* Created for Alessandro Palazzolo's question:
https://www.sololearn.com/Discuss/1569670
Variable's strings count
How can i count how many times a letter repeats herself between many variables?
var match3 = "V";
var match2 = "S";
var match3 = "v";
then how can I put an If statement that processes something if there are two "v" and one "s"?
*/
function count(string) {
let result = [0, 0, 0];
switch (string) {
case "a":
result[0]++;
break;
case "b":
result[1]++;
break;
case "c":
result[2]++;
break;
}
return result;
}
let final = [0, 0, 0];
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run