JavaScript Split

We are already using split function in c# server-side code, In below code is the Split function in client-side code.ASPX Page
 
Aspx page
  1. <asp:Text Box runat="server" ID="text1"></asp:Text Box>  
  2. <asp:Text Box runat="server" ID="text2"></asp:Text Box>  
  3. <asp:Button ID="btn" runat="server" text="reverse" onClientClick="reverse(this)"></asp:Button> 
Script
  1. function reverse(evt1) {  
  2.     var txt = document.getelementById("text1").value;  
  3.     var n = text.split(" ");  
  4.     document.getElementById("text2").value = n[1] + " " + n[0];