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
<div class = "containter-fluid"> | |
<div class ="header"> | |
<div class = "well"> | |
<h1 class = "text-primary text-center">Dr.Julius Kambarage Nyerere</h1> | |
<p class = "text-center">Tanzanian statesman and president Julius Kambarage was premier when Tanganyika was granted internal self-government, and was made president on independence</p> | |
</div> | |
</div> | |
<div class = "containter"> | |
<div class = "well"> | |
<img class="img-responsive" src="https://media1.britannica.com/eb-media/77/160377-004-ECB7BCBD.jpg" alt="Julius Nyerere" width = "100%" height = "auto"> |
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
//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 { |
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
Write a function called "getElementsThatEqual10AtProperty". | |
Given an object and a key, "getElementsThatEqual10AtProperty" returns an array containing all the elements of the array located at the given key that are equal to ten. | |
Notes: | |
* If the array is empty, it should return an empty array. | |
* If the array contains no elements equal to 10, it should return an empty array. | |
* If the property at the given key is not an array, it should return an empty array. | |
* If there is no property at the key, it should return an empty array. | |
function getElementsThatEqual10AtProperty(obj, key) { |
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
Write a function called "select". | |
Given an array and an object, "select" returns a new object whose properties are those in the given object AND whose keys are present in the given array. | |
Notes: | |
* If keys are present in the given array, but are not in the given object, it should ignore them. | |
* It does not modify the passed in object. | |
function select(arr, obj) { | |
// create an empty obj | |
var output = {}; |
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
. | |
Given an array of elements, and a "discarder" parameter, "removeElement" returns an array containing the items in the given array that do not match the "discarder" parameter. | |
Notes: | |
* If all the elements match, it should return an empty array. | |
* If an empty array is passed in, it should return an empty array. | |
function removeElement(array, discarder) { |
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
Notes: | |
* If the array is empty, it should return undefined. | |
* If the property at the given key is not an array, it should return undefined. | |
* If there is no property at the key, it should return undefined. | |
function getFirstElementOfProperty(obj, key) { | |
// your code here | |
if ( Array.isArray( obj[key] ) === false ){ | |
return undefined; | |
}else if ( obj[key][0] === undefined){ | |
return 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
Notes: | |
* If the array is empty, it should return undefined. | |
* If n is out of range, it should return undefined. | |
* If the property at the given key is not an array, it should return undefined. | |
* If there is no property at the key, it should return 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
Notes: | |
* If the array is empty, it should return undefined. | |
* if the property at the given key is not an array, it should return undefined. | |
* If there is no property at the key, it should return undefined. | |
function getLastElementOfProperty(obj, key) { |
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
Notes: | |
* If no elements match, "keep" should return an empty array. | |
function keep(array, keeper) { | |
if(Array.isArray(array) === false){ | |
return null; | |
} | |
return array.filter(function(value) { | |
return value == keeper; |
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
Notes: | |
* If the array is empty, it should return an empty array. | |
* If it contains no odd length elements, it should return an empty array. | |
* If the property at the given key is not an array, it should return an empty array. | |
* If there is no property at the given key, it should return an empty array. | |
function getOddLengthWordsAtProperty(obj, key) { | |
// your code here | |
OlderNewer