Q:

Javascript brackets error

Why do I get an error in this line? I cleaned up the code and let only the parts where it opens and closes.
Actually there is a parenthesis in more, but I can not figure out where.
Parse.Cloud.job("test", function(request, status) {

query.find().then(function(results) {

        for (var i = 0; i < deals.length; i++) {

        }

    }).then(function() {

      Parse.Object.saveAll([array01, array02], {

        success: function(list) {

            if (status) {

            };

        }, error: function(model, error) {

            if (status) {

            };

        }); //THIS!!!!!!

    }, function(error) {

    });

})
});

A:

With reasonable indentation, your script looks like this:
Parse.Cloud.job("test", function(request, status) {
    query.find().then(function(results) {
        for (var i = 0; i < deals.length; i++) {}
    }).then(function() {
        Parse.Object.saveAll([array01, array02], {
            success: function(list) {
                if (status) {}
                ;
            },
            error: function(model, error) {
                if (status) {}
                ;
            }); //THIS!!!!!!
//           ^^
        }, function(error) {});
    })
});

which clearly shows the the ); is too much there - in the middle of an object literal. The invocation of Parse.Object.saveAll ends only after that empty function callback. Alternatively, you might have wanted to do
Parse.Cloud.job("test", function(request, status) {
    query.find().then(function(results) {
        for (var i = 0; i < deals.length; i++) {}
    }).then(function() {
        return Parse.Object.saveAll([array01, array02], {
            success: function(list) {
                if (status) {}
            },
            error: function(model, error) {
                if (status) {}
            } // <-- close function body
        }); //THIS!!!!!!
    }, function(error) {
    });
    // <-- remove superfluous })
});

where function(error) { } is a callback to then, not to saveAll.

