title: How to replace sharepoint group users with new users?
body: <blockquote>
    <p>This is I'm upto</p>
  </blockquote>
  
  <pre><code>var clientContextForGroup = new SP.ClientContext.get_current();
      var siteGroups = clientContextForGroup.get_web().get_siteGroups();
      var web = clientContextForGroup.get_web();
      spGroup = siteGroups.getByName(GroupName);
  
      var userCollection = spGroup.get_users();
  
      $.each(MembersArray, function (index, tempitem) {
          var userCreationInfo = new SP.UserCreationInformation();
          userCreationInfo.set_email(tempitem.EMail);
          userCreationInfo.set_loginName(tempitem.Name);
          userCreationInfo.set_title(tempitem.Title);
          userCollection.add(userCreationInfo);
      });
  
      clientContextForGroup.load(userCollection);
      clientContextForGroup.executeQueryAsync(function () {
          console.log("added in SPGroup");
      }, function (sender, args) {
          console.log("Sorry Some Error occurred in adding user in SPGroup...");
      });
  </code></pre>
  
  <blockquote>
    <p>this adds new member if any in 'MembersArray'.
    I want to replace all members with new members.</p>
  </blockquote>