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) { | |
const phoneRegxep = /^((\(\d{3}\))|((1\s|1)\(\d{3}\))|(\d{3})|(1\s\d{3}))(\s|-|)(\d{3})(\s|-)(\d{4})/ | |
const d10 = /^\d{10}$/ | |
return phoneRegxep.test(str) || d10.test(str); | |
} | |
// phone formats | |
// 555-555-5555 |
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 rot13Decode(str) { | |
return [...str].map( el => { | |
const code = el.charCodeAt(0) | |
const newCode = code > 77 && code < 91 ? + code - 13 : | |
code > 64 && code < 78 ? code + 13 : code | |
return String.fromCharCode(newCode) | |
}).join(''); | |
} |
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) { | |
const arr = num.toString().split('').map( el => +el).reverse(); | |
let res = '' | |
const v10 = [ | |
'I', 'X', 'C', 'M' | |
] | |
const v5 = [ | |
'V', 'L' , 'D' | |
] | |
arr.forEach( (el, i) => { |