Yep. Worked fine.
Code:
<html>
<body>
<script type="text/javascript">
function calculateName(name)
{
return (name.toUpperCase() + "XXX" ).replace( /[aeiou]/ig, "" ).substring(0,3);
}
function calculateName2(name)
{
return (name.charAt(0) + (name + "XXX").substring(1).replace(/[aeiou]/ig,"") ).substring(0,3).toUpperCase();
}
function demo( word )
{
document.write( word + "==>> (1) " + calculateName(word) + ", ==>> (2) " + calculateName2(word) + "<hr/>" );
}
demo("zamboni");
demo("alphabet");
demo("zoo");
demo("oui");
</script>
</body>
</html>
Note: Both functions work for words of at least 1 letter. The second one will fail if given a word with no characters. The first one will produce "XXX".