/*
1. Write a program to display numbers with 1 sec delay.
2. Count Uppercase, Lowercase, special character and numeric values
3. How to find duplicate characters in a String?
4. How to check if a String contains only digits?
5. How to count the occurrence of a given character in String?
6. How to remove duplicate characters from String?
7. How to return the highest occurred character in a String?
8. Merge Two Sorted Arrays?
9. How would you check if a number is an integer?
*/
// #####################111111111111111111###############
/* for (let i = 1; i <= 10; i++) {
setTimeout(function(){
console.log(i)
},i*1000);
} */
// ###########222222222222222###############
/* let upperCase = 0;
let lowerCase = 0;
let num = 0;
let specialChars = 0
function countUpperCaseChars(str) {
let len=str.length;
for(var i=0;i<len;i++) {
if(/[A-Z]/.test(str.charAt(i))) upperCase++;
else if(/[a-z]/.test(str.charAt(i))) lowerCase++;
else if(/[0-9]/.test(str.charAt(i))) num++;
else specialChars++
}
return [upperCase,lowerCase,num,specialChars]
}
console.log(countUpperCaseChars('abcDE123#.@s')) */
// ###########33333333333333333333###############
/* var example = 'hello';
var charRepeats = function(str) {
for (var i=0; i<str.length; i++) {
if ( str.indexOf(str[i]) !== str.lastIndexOf(str[i]) ) {
return false; // repeats
}
}
return true;
}
console.log( charRepeats(example) ); */
// -------- To get count
/* function getFrequency(string) {
var freq = {};
for (var i=0; i<string.length;i++) {
var character = string.charAt(i);
if (freq[character]) {
freq[character]++;
} else {
freq[character] = 1;
}
}
return freq;
};
getFrequency('Indivisibilities'); */
// ##################### 4444444444444444444444444444444444444######################
//let isnum = /^\d+$/.test(val);
// ######################555555555555555555555555555#######################
/* function...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.