Strings: Username Creation: JS

Strings: Username Creation: JS

<script type="text/javascript">
 function generateUsername(){
  document.getElementById('usernameResult').innerHTML = '';
  first_name = document.getElementById('first_name').value;
  last_name = document.getElementById('last_name').value;
  username = first_name.substring(0,3) + last_name;
  document.getElementById('usernameResult').innerHTML = 'Generated Username: ' + username;
 }
</script>
Comments are closed.