My spouse works remotely and regularly needs to rattle off long cryptic strings by phone. Most people don’t have a phonetic alphabets memorized and stumble when trying to convey complex strings verbally.
Within about an hour, I gave her this one-click bookmark that prompts for input, then displays the NATO phonetic equivalent.
javascript:if(input=prompt("Characters")){for(i=0,result=[],letters={a:"Alfa",b:"Bravo",c:"Charlie",d:"Delta",e:"Echo",f:"Foxtrot",g:"Golf",h:"Hotel",i:"India",j:"Juliett",k:"Kilo",l:"Lima",m:"Mike",n:"November",o:"Oscar",p:"Papa",q:"Quebec",r:"Romeo",s:"Sierra",t:"Tango",u:"Uniform",v:"Victor",w:"Whiskey",x:"Xray",y:"Yankee",z:"Zulu"};i<input.length;i++)char=input[i].toLowerCase(),item=void 0!==letters[char]?letters[char]:char,result[result.length]=input[i]==input[i].toLowerCase()?item.toLowerCase():item.toUpperCase();result.length&&(output=alert(input+":\r\n"+result.join(" ").replace(/\s+/g," ")))}
Continue reading