Minimum:
function min(a, b){
if (a <= b){
return a;
}
else {
return b;
}
}
Recursion:
function isEven(num){
if(num == 0){
return true;
}
else if (num == 1){
return false;
}
else if (num < 0){
return isEven(-num);
}
else {
return isEven(num - 2);
}
}
Bean Counting:
function countBs(str){
let c = 0;
for(let i = 0; i < str.length; i++){
if (str[i] == "b" || str[i] == "B"){
c++;
}
}
return c;
}
function countChar(str, char){
let c = 0;
for(let i = 0; i < str.length; i++){
if (str[i] == char.toLowerCase() ||
str[i] == char.toUpperCase()){
c++;
}
}
return c;
}