If you want to know what role continue plays here, how should you rewrite it if you get rid of it?

    var my_department = [];
                    for (var i = 0; i < aggregations.all_outdept_name.buckets.length; iPP) {
                        if (aggregations.all_outdept_name.buckets[i].key == "") continue;
                        var department_obj = {
                            value: aggregations.all_outdept_name.buckets[i].key,
                            label: aggregations.all_outdept_name.buckets[i].key,
                            count: aggregations.all_outdept_name.buckets[i].doc_count
                        }
                        my_department.push(department_obj);
                    }
                    _this.department = my_department;
Apr.19,2021

continue means to skip this cycle and start the next cycle immediately. In your code, if you execute continue, then the if statement continue will not be executed. A new round of cycle judgment is performed after iPP.

if you want to get rid of it, you can write it backwards, that is, execute the following statement under if continue when the xxx condition is met

.
for (var i = 0; i < aggregations.all_outdept_name.buckets.length; iPP) {
    if (!(aggregations.all_outdept_name.buckets[i].key == '')){
        var department_obj = {
            value: aggregations.all_outdept_name.buckets[i].key,
            label: aggregations.all_outdept_name.buckets[i].key,
            count: aggregations.all_outdept_name.buckets[i].doc_count
        }
        my_department.push(department_obj);
    }
}
Menu