This file contains hidden or 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 steamrollArray(arr) { | |
let flatArr = []; | |
for(let item of arr){ | |
if(Array.isArray(item)){ | |
flatArr.push(...item.map(i => getValFromNestedArr(i))) | |
} | |
else { | |
flatArr.push(item) | |
} | |
} |
This file contains hidden or 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
const CLOSED = "CLOSED"; | |
const INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS"; | |
const OPEN = "OPEN"; | |
const PENNY = 0; | |
const NICKEL = 1; | |
const DIME = 2; | |
const QUARTER = 3; | |
const ONE = 4; | |
const FIVE = 5; |
This file contains hidden or 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 telephoneCheck(str) { | |
if(!parenthesesBalanced(str)){ | |
return false; | |
} | |
const regex = /^1?\s*(\(?\d{3}\)?[-]?\s*){2}\d{4}$/ | |
return regex.test(str); | |
} | |
function parenthesesBalanced(str){ | |
const openBracketRegex = /\(/g |
This file contains hidden or 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 createAlphabetArr(){ | |
const first = 'A'.charCodeAt(); | |
const second = 'Z'.charCodeAt(); | |
let alphabet = []; | |
for(let code = first; code <= second; code++) { | |
alphabet.push(String.fromCharCode(code)) | |
} | |
return alphabet; | |
} |
This file contains hidden or 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
const symbols = { | |
'1': 'I', | |
'5' : 'V', | |
'10' : 'X', | |
'50' : 'L', | |
'100' : 'C', | |
'500' : 'D', | |
'1000' : 'M' | |
}; |
This file contains hidden or 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) { | |
let text = str.toLowerCase().replace(/[^a-z0-9]/g, ""); | |
const revText = text.split("").reverse().join(""); | |
return text === revText; | |
} |
This file contains hidden or 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="container-fluid"> | |
<h1 class="text-center mb-3">Bootstrap Multi-Card Carousel</h1> | |
<div id="myCarousel" class="carousel slide" data-ride="carousel"> | |
<div class="carousel-inner row w-100 mx-auto"> | |
<div class="carousel-item col-md-4 active"> | |
<div class="card"> | |
<img class="card-img-top img-fluid" src="http://placehold.it/800x600/f44242/fff" alt="Card image cap"> | |
<div class="card-body"> | |
<h4 class="card-title">Card 1</h4> | |
<p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p> |
This file contains hidden or 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 customName = document.getElementById('customname'); | |
var randomize = document.querySelector('.randomize'); | |
var story = document.querySelector('.story'); | |
function randomValueFromArray(array){ | |
return array[Math.floor(Math.random()*array.length)]; | |
} | |
var storyText = "It was 94 farenheit outside, so :insertx: went for a walk. When they got to :inserty:, they stared in horror for a few moments, then :insertz:. Bob saw the whole thing, but he was not surprised — :insertx: weighs 300 pounds, and it was a hot day."; |