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 checkCashRegister(price, cash, cid) { | |
var change = cash - price; | |
var coinValues = [ | |
{ name: 'ONE HUNDRED', val: 100.00 }, | |
{ name: 'TWENTY', val: 20.00 }, | |
{ name: 'TEN', val: 10.00 }, | |
{ name: 'FIVE', val: 5.00 }, | |
{ name: 'ONE', val: 1.00 }, | |
{ name: 'QUARTER', val: 0.25 }, |
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 telephoneCheck(str) { | |
var regex1 = /^[0-9]{3}[-][0-9]{3}[-][0-9]{4}$/; | |
var regex2 = /^[(][0-9]{3}[)][0-9]{3}[-][0-9]{4}$/; | |
var regex3 = /^[(][0-9]{3}[)][\s][0-9]{3}[-][0-9]{4}$/; | |
var regex4 = /^[0-9]{3}[\s][0-9]{3}[\s][0-9]{4}$/; | |
var regex5 = /^[0-9]{10}$/; | |
var regex6 = /^[1]{1}[\s][0-9]{3}[\s][0-9]{3}[\s][0-9]{4}$/; | |
var regex7 = /^[1]{1}[\s][0-9]{3}[-][0-9]{3}[-][0-9]{4}$/; | |
var regex8 = /^[1]{1}[\s][(][0-9]{3}[)][\s][0-9]{3}[-][0-9]{4}$/; | |
var regex9 = /^[1]{1}[(][0-9]{3}[)][0-9]{3}[-][0-9]{4}$/; |
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 rot13(str) { | |
newstr = str.split(""); | |
var finalstr = newstr.map(function(letter) { | |
lettervalue = letter.charCodeAt(0); | |
if (lettervalue < 65 || lettervalue > 90) { | |
return String.fromCharCode(lettervalue); | |
} | |
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 convertToRoman(num) { | |
var englishArray = [1000000, 500000, 100000, 50000, 10000, 5000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]; | |
var romanArray = ["M̄", "D̄", "C̄", "L̄", "X̄", "V̄", "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"]; | |
var Roman = ""; | |
for (var i=0; i<=englishArray.length; i++) { | |
while (num%englishArray[i] < num) { | |
Roman += romanArray[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 newstr = str.replace(/[\W\_]/gi, "").toLowerCase(); | |
array = newstr.split("").reverse().join(""); | |
if (newstr === array) { | |
return true; | |
} | |
else return false; | |
}; |