Skip to content

Instantly share code, notes, and snippets.

@morisasy
Created July 12, 2017 08:06
Show Gist options
  • Save morisasy/b336e603a250a82b165e4de66cd28a6a to your computer and use it in GitHub Desktop.
Save morisasy/b336e603a250a82b165e4de66cd28a6a to your computer and use it in GitHub Desktop.
findMinLengthofThreeWords
//Write a function called "findMinLengthOfThreeWords".
//Given 3 words, "findMinLengthOfThreeWords" returns the length of the shortest word.
function findMinLengthOfThreeWords(word1, word2, word3) {
if (word1.length < word2.length) {
if (word1.length <word3.length) {
return word1.length;
}else {
return word3.length;
}
}else {
if(word2.length < word3.length) {
return word2.length;
}else {
return word3.length;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment