Skip to content

Instantly share code, notes, and snippets.

<!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">
<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)
{
<script id="jsbin-javascript">
//Challenge 10 Anagram
//Returns true if anagram is false or not
function isAnagram(str1, str2)
{
return formatStr(str1) === formatStr(str2);
}
<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);
<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 = [];
<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
<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()
{
<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;
<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
<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('');