Using Slice to Select Characters

Click the button to enter your details.

Code Example

<script>
 let firstName = prompt("Please enter your first name", "Jason");
 let firstThree = firstName.slice(0, 3);
 let lastName = prompt("Please enter your last name", "Bruce");
 let lastThree = lastName.slice(0, 3);
   document.getElementById('data').innerHTML = "Your new nickname is " + firstThree + lastThree + "<br>";
  
 let companyName = prompt("Wher do you work?");

 let firstThreeCo = companyName.charAt(0, 3);
   document.getElementById('data').innerHTML += "We'll abreviate your workplace to " + firstThreeCo + ", okay?" + "<br>";
  
 let text = "It is startling to think that, even in the darkest depths of World War II,
J. R. R. Tolkien was writing the trilogy, which contains, with the applicability available
only to poetry and myth, the essential notion that the good grey wizard can understand the evil
magi precisely because he is just enough like them to grasp their minds and motives in ways that
they cannot grasp."; </script>