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
function translate(str) { | |
var vowel = ['a', 'e', 'i', 'o', 'u']; | |
var stop = false; | |
var numberOfConsonant = 0; | |
str = str.split(''); | |
length = str.length; | |
strNew = str; | |
for (var i = 0; i < length; i++) { | |
if (vowel.indexOf(str[0]) !== -1 && !stop){ | |
strNew.push('way'); |
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
function pair(str) { | |
var dnaPair = []; | |
var result = []; | |
str = str.split(''); | |
for (var i in str) { | |
if (str[i] === 'A') { | |
dnaPair.push('A'); | |
dnaPair.push('T'); | |
} else if (str[i] === 'T') { | |
dnaPair.push('T'); |
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
function fearNotLetter(str) { | |
var missing = ''; | |
var isMissing = false; | |
for (var i = 0; i < str.length-1; i++) { | |
if (str.charCodeAt(i+1) - str.charCodeAt(i) !== 1 && !isMissing) { | |
missing = String.fromCharCode(str.charCodeAt(i)+1); | |
isMissing = true; | |
} else if (!isMissing) { | |
missing = undefined; | |
} |
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
function boo(bool) { | |
// What is the new fad diet for ghost developers? The Boolean. | |
if (typeof(bool) === 'boolean') { | |
var isBoolean = true; | |
} else { | |
isBoolean = false; | |
} | |
return isBoolean; | |
} |
OlderNewer