$('#add_to_admins').click(function() {
    add_emails('admin')
})

$('#add_to_members').click(function() {
    add_emails('member')
})

$('#clear_admins').click(function(){
    clear_emails('admin')
})

$('#clear_members').click(function(){
    clear_emails('member')
})


function add_emails(user_type){
    var email_address = $('input[name=user_email]').val();
    var email_list_string = $('input[name=' + user_type + '_emails_to_add]').val().trim()
    console.log(email_list_string)
    if (email_list_string == ""){
        var email_set = new Set();
    } else {
        var email_set = new Set(email_list_string.split(","))
    }
    email_set.add(email_address)

    $('input[name=' + user_type + '_emails_to_add]').val(Array.from(email_set).join(','))

    var emails_display_string = Array.from(email_set).join('\n')
    $('.added_' + user_type + 's').val(emails_display_string)
}

function clear_emails(user_type){
    $('input[name=' + user_type + '_emails_to_add]').val("")
    $('.added_' + user_type + 's').val("")
}
@@ -298,27 +298,27 @@
 _type)%7B%0A    
-var
+let
  email_addre
@@ -357,27 +357,27 @@
 .val();%0A    
-var
+let
  email_list_
@@ -451,43 +451,8 @@
 m()%0A
-    console.log(email_list_string)%0A
     
@@ -481,35 +481,35 @@
 == %22%22)%7B%0A        
-var
+let
  email_set = new
@@ -533,27 +533,27 @@
 e %7B%0A        
-var
+let
  email_set =
@@ -730,11 +730,11 @@
     
-var
+let
  ema
@@ -991,8 +991,9 @@
 al(%22%22)%0A%7D
+%0A

Replace "var" with "let"