This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Coderbyte | |
function ThirdGreatest(strArr) { | |
var matrix=[]; | |
//build the array, two dimensions | |
for (var i=0; i<strArr.length;i++){ | |
matrix.push([strArr[i].length,strArr[i]]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//coderbyte | |
function NumberAddition(str) { | |
var mathches, | |
total=0; | |
// use regexp to grab the numbers | |
matches=str.match(/([\d]+)/g); | |
//itereate and add |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//coderbyte | |
function SwapCase(str) { | |
var newChar='', | |
newString=''; | |
newString = str.replace(/./g, function(myChar){ | |
//use the replace to iterate and rebuild string | |
if (myChar.match(/[a-z]/)){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//coderbyte | |
function DashInsert(num) { | |
var prev='', | |
newstring=''; | |
num = num.toString(); | |
for (var i=0; i<num.length; i++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Coderbyte | |
function MeanMode(arr) { | |
var sum=0, | |
mean, mode, midpoint, modeStr, re, | |
champTotal=0; | |
//old faithful | |
arr.sort(function(a, b) { | |
return a - b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Coderbyte Challenge | |
function CountingMinutesI(str) { | |
var when, | |
offset, | |
mins, | |
segments = [], | |
ampm, | |
hours, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Coderbyte DivisionStringified | |
function DivisionStringified(num1,num2) { | |
//divide, round, convert | |
var result = x = Math.round(num1/num2).toString(); | |
var groups =[]; | |
//section out 3 digits at a time from end | |
while (result.length>3){ | |
pusher=result.slice(result.length-3,result.length); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Coderbyte Challenge | |
Using the JavaScript language, have the function SecondGreatLow(arr) take the array of numbers stored in arr | |
and return the second lowest and second greatest numbers, respectively, separated by a space. | |
For example: if arr contains [7, 7, 12, 98, 106] the output should be 12 98. | |
The array will not be empty and will contain at least 2 numbers. | |
*/ | |
function SecondGreatLow(arr) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Coderbyte Challange. | |
function LetterCountI(str) { | |
var words = str.split(' '), | |
champWord='', | |
champTotal=0, | |
champLetter='', |