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
var elements = document.querySelectorAll("h1"); | |
Object.keys(elements).forEach(function(key) { | |
elements[key].style.color = "orange"; | |
}); |
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 returnLargest(arr) { | |
var newArr = []; | |
for (var i = 0; i < arr.length; i++) { | |
var subArray = arr[i]; | |
var largest = arr[i][0]; | |
for (var j = 0; j < arr[i].length; j++) { | |
if (subArray[j] > largest) { |
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 titleCase(str) { | |
var splitString = str.split(" "); | |
var newArray = []; | |
for (var i = 0; i < splitString.length; i++) { | |
var splitWord = splitString[i].split(""); | |
splitWord[0] = splitWord[0].toUpperCase(); | |
for (var j = 1; j < splitWord.length; j++) { |
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 findLongestWord(str) { | |
var splitString = str.split(" "); | |
var longestString = splitString[0]; | |
for (var i = 0; i < splitString.length; i++) { | |
if (splitString[i].length > longestString.length) { | |
longestString = splitString[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
function palindrome(str) { | |
var strAlt = str.toLowerCase(); | |
strAlt = strAlt.replace(/\s/g, ""); | |
strAlt = strAlt.replace(/\W/g, ""); | |
strAlt = strAlt.replace(/_/g, ""); | |
if (strAlt.split("").reverse().join("") == strAlt) { | |
return true; | |
} 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
//Setup | |
var contacts = [ | |
{ | |
"firstName": "Akira", | |
"lastName": "Laine", | |
"number": "0543236543", | |
"likes": ["Pizza", "Coding", "Brownie Points"] | |
}, | |
{ |
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
//Setup | |
var contacts = [ | |
{ | |
"firstName": "Akira", | |
"lastName": "Laine", | |
"number": "0543236543", | |
"likes": ["Pizza", "Coding", "Brownie Points"] | |
}, | |
{ | |
"firstName": "Harry", |