Skip to content

Instantly share code, notes, and snippets.

@Tsa6
Last active January 1, 2016 01:48
Show Gist options
  • Save Tsa6/8074742 to your computer and use it in GitHub Desktop.
Save Tsa6/8074742 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<button onclick='run()' type = 'button'>Run</button>
<p id='Intro'> Click 'Run' to find words in your phone number. This may cause lots of lag.</p>
<script src = './PhoneToWords_javascript.js' tpye = 'text/javascript'></script>
</body>
</html>
function run() {
var OneList = ['1', '1', '1', '1'];
var TwoList = ['A', 'B', 'C', 2];
var ThreeList = ['D', 'E', 'F', 3];
var FourList = ['G', 'H', 'I', 4];
var FiveList = ['J', 'K', 'L', 5];
var SixList = ['M', 'N', 'O', 6];
var SevenList = ['P', 'Q', 'R', 'S'];
var EightList = ['T', 'U', 'V', '8'];
var NineList = ['W', 'X', 'Y', 'Z'];
var ZeroList = ['0', '0', '0', '0'];
var phoneNum = prompt('Type your, or a fake, phone number. No spaces, dashes, or anything else. Just numbers or it will break the program.', 5553141596);
var counter = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var runCount = 0;
var analizeNum;
var curCounter;
var allPhones = '';
var curPhone = '';
do {
for (var i = 0; i !== 11; i++) {
Turtles = true;
analizeNum = phoneNum.charAt(i);
curCounter = counter[i];
if (analizeNum === 0) {
curPhone = ZeroList[i];
}
if (analizeNum === 1) {
curPhone += OneList[i];
}
if (analizeNum === 2) {
curPhone += TwoList[i];
}
if (analizeNum === 3) {
curPhone += ThreeList[i];
}
if (analizeNum === 4) {
curPhone += FourList[i];
}
if (analizeNum === 5) {
curPhone += FiveList[i];
}
if (analizeNum === 6) {
curPhone += SixList[i];
}
if (analizeNum === 7) {
curPhone += SevenList[i];
}
if (analizeNum === 8) {
curPhone += EightList[i];
}
if (analizeNum === 9) {
curPhone += NineList[i];
}
}
allPhones += curPhone + '</br>';
counter[1]++;
for (i = 0; i !== 10; i++) {
if (counter[i] === 4) {
counter[i] = 0;
counter[i + 1]++;
}
}
runCount++;
document.getElementById('Intro').innerHTML = counter;
}
while(counter[9] !== 4);
alert(counter[1]);
document.getElementById('Intro').innerHTML = allPhones;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment