I'm using SSJS to pull api data and build emails. I have an array built that has some duplicate data in it. I'm looking for anyway to remove the duplicate information. I've tried all the regular JS methods, filter, spread operator, etc... but not seem to the trick. Does anyone have any experience with or any ideas?

var uniqe_mls_array = [...Set new(mls_text_array)]; // Didn't work, can't use new

Any help would be greatly appreciated, thank you.

1 Answer 1


The following seems to work but may be overkill:

    var outputArray = [];
    var count = 0;
    var start = false;

for (j = 0; j < mls_text_array.length; j++) {
    for (k = 0; k < outputArray.length; k++) {
        if (mls_text_array[j] == outputArray[k]) {
            start = true;
    if (count == 1 && start == false) {
    start = false;
    count = 0;

Variable.SetValue("@mls_text_string", outputArray.toString());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.