Count occurances
How do I make an count occurances?
What is a count occurances? How do you make a count occurances? This script and codes were developed by Maria on 14 October 2022, Friday.
Count occurances - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Count occurances</title>
</head>
<body> <script src="js/index.js"></script>
</body>
</html>
Count occurances - Script Codes JS Codes
var temp = "abababababababababbabababababa";
var count = (temp.match(/is/g) || []).length;
console.log(count);
function x(n1, n2, str) { var k = []; var l = str.length; for (var i = 0; i < l; i++) { var f = str.substr(i, n1); var s = str.substr(i, n2); if (f.length == n1) k.push(f); if (s.length == n2) k.push(s); } var obj = {}; for (let o of k) { //console.log(o); if (!obj[o]) obj[o] = 1 else obj[o] += 1 } var objMax = function() { var max = {}; for (var key in obj) { // console.log(key+" "+obj[key]) if(max.num) { if (max.num < obj[key]) { max.num = obj[key]; max.key = key; } } else { max.num = obj[key]; max.key = key; } }; return ("'"+max.key+"' occurs "+max.num); }(); console.log(objMax);
}
console.log(x(2, 3, temp));
Developer | Maria |
Username | tmaria |
Uploaded | October 14, 2022 |
Rating | 3 |
Size | 1,648 Kb |
Views | 42,504 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Exercise | 1,580 Kb |
Stack | 1,571 Kb |
Simple Username and Password Check in JS | 2,686 Kb |
Pyramid | 1,409 Kb |
A Pen by Maria | 7,159 Kb |
JSON Practice | 2,959 Kb |
Fibonacci | 1,923 Kb |
ArrayPractice | 1,673 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Responsive Pricing Table | Jeremycaris | 2,690 Kb |
Replace url via jquery | Serluk | 1,429 Kb |
Funny menu | AxeLVaisper | 4,671 Kb |
CSS Tooltips | Darylldoyle | 2,599 Kb |
Testing Code Pen | Jduprey | 1,468 Kb |
GsuiPopup | Mr21 | 2,641 Kb |
Mobile first social buttons with no iframe | Alistairtweedie | 3,158 Kb |
Basic HTML Slideshow | Tomhodgins | 3,386 Kb |
CSS Google Now | Jackmoran | 3,196 Kb |
Awesome textarea | Ayoungh | 1,977 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!