JSFiddle - React, Tailwind, and code Playground

JavaScript

var result = false;
    var checks = 0;
    $.each([1, 2, 3, 4, 5], function () {
        $.each([1, 2, -1, 4, 5], function (i, elem) {
            checks++;
            if (elem < 0) {
                result = true;
                return false; //break inner loop
            }
        });
        if (result) return false; //break outer loop if we got true in inner
    });
    
    console.log(checks);
    console.log(result);