Skip to content

Instantly share code, notes, and snippets.

@markjanzer
markjanzer / SecondHighLow
Last active August 29, 2015 14:24
SecondHighLow
function SecondGreatLow(arr) {
arr = arr.sort(function (a, b) {return a - b});
return secondLow(arr) + " " + secondHigh(arr);
}
function secondLow(arr) {
for (var i = 0; i < arr.length; i++)
if (arr[i] !== arr[i +1])
return (arr[i + 1]);
// function that creates an object that tells me how many times each letter
// was repepated in a string.
// Also have it tell me which letter was repeated the most and how many times it repeated
function objectify(str) {
str = str.toLowerCase();
var obj = {};
for (i = 0; i < str.length; i++) {
if (str[i] in obj)
@markjanzer
markjanzer / LetterCountI
Created June 29, 2015 21:43
LetterCountI
function LetterCountI(str) {
str = str.split(" ");
var answer = "";
var mostRep = 1;
for (i = 0; i < str.length; i++)
if (eachWord(str[i]) > mostRep) {
mostRep = eachWord(str[i]);
answer = str[i];
}
if (mostRep === 1)