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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
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
<script id="jsbin-javascript"> | |
//Challenge 11 | |
//Change every letter of the string to the one that follows it and capitalize the | |
//Vowels | |
function letterChanges(str){ | |
let newStr = str.toLowerCase().replace(/[a-z]/gi, function(char) | |
{ |
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
<script id="jsbin-javascript"> | |
//Challenge 10 Anagram | |
//Returns true if anagram is false or not | |
function isAnagram(str1, str2) | |
{ | |
return formatStr(str1) === formatStr(str2); | |
} |
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
<script id="jsbin-javascript"> | |
//Challenge 9 Flatten array | |
//Take an array of arrays and flatten to a single array | |
function flattenArray(arrays) | |
{ | |
return arrays.reduce(function(a,b) | |
{ | |
return a.concat(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
<script id="jsbin-javascript"> | |
//Challenge 8: Array Chunking | |
//Split an array into chunked arrays of a specific length | |
//ex. chunkArray | |
function chunkArray(arr, len) | |
{ | |
// Init chunked arr | |
const chunkedArr = []; |
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
<script id="jsbin-javascript"> | |
//Challenge 7: The longest Word | |
//Returns the longest word of a string | |
//If more than one longest word, put it into an array | |
//ex. longestword | |
function longestWord(sen) | |
{ | |
//Create filtered array |
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
<script id="jsbin-javascript"> | |
//Challenge 6: FIZZBUZZ | |
//Write a program that prints all of the numbers from 1 to 11 in multiples of 3, | |
//instead of the number, print "fizz", for multiples of 5 print "buzz", for numbers | |
//Which are mutiples ofboth 3 and 5, print "Fizzbuzz". | |
function fizzbuzz() | |
{ |
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
<script id="jsbin-javascript"> | |
// Challenge 5. Max Character | |
// Returns a character that is most common in a string | |
// | |
function maxCharacter(str) | |
{ | |
const charMap = {}; | |
let maxNum = 0; |
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
<script id="jsbin-javascript"> | |
// Challenge 4. Capitalize letters | |
// Returns a string with the first letter of every word capitalized | |
// ex. capitalizeLetters('I love javascript') === 'I love Javascript' | |
function capitalizeLetters(str) | |
{ | |
//Takes a lowercase string and splits it |
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
<script id="jsbin-javascript"> | |
// Challenge 3: Reverse an Int | |
// Return an integer in reverse | |
// ex. reverseInt(521) = 125 | |
function reverseInt(int) | |
{ | |
//Turns the number into a string than it reverses it | |
const revString = int.toString().split('').reverse().join(''); | |
NewerOlder