title: Javascript replace values in a string
body: <p>I am framing a Javascript string as follows as per my requirement:</p>
  
  <pre><code>var empDetails= "ID=" + id + ";" + "Name=XYZ" + ";" + "Address=ABC";
  // id is autoincremented like 1,2,3 and so on.
  
  if (sessionStorage.getItem('empDet') === null) {
      sessionStorage.setItem('empDet', empDetails);
  } else {
      var empDets= sessionStorage.getItem('empDet');
      var pResult = empDets;
      if (pResult.length &gt; 0) {
          var ptotalEmp= empDets.toString().concat(';' + empDetails.toString());
          sessionStorage.setItem('empDet', ptotalEmp);
      }
  }
  </code></pre>
  
  <p>Now what I need to I will provide some option to edit the following details if user selected some id and if he change some thing related to <code>Name and Address</code> I need to update that and store. Can some one help me? </p>