F
F
fandorin_official2018-02-19 06:38:11
JavaScript
fandorin_official, 2018-02-19 06:38:11

Why does the code stop at the return line?

Can you please tell me why the code stops at the line return start() ;, but does not call function start() ?

function start() {
            result_lost = getRead();
            $('.read_htable input[name=bet]').val(parseFloat(write).toFixed(8));
            var Btn = $('.read_htable .clRead')[6];
            Btn.onclick(checkResult());
        }
        function checkResult(){
            result = getRead();
            if (IsOk(result)) {
                doSomething(result);
            } else if (index_IsOk > 99) {
                return start();
            } else {
                setTimeout(checkResult, 1000);
            }
        }
        function IsOk(result) {
            index_IsOk++;
            return result != result_lost;
        }
        function getRead() {
            var read_text = $('.read_select .chosen-single span').text();
            var regex = /[+-]?\d+(\.\d+)?/g;
            var floats = read_text.match(regex).map(function(v) {
                return parseFloat(v).toFixed(8);
            });
            return floats[0];
        }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lynn "Coffee Man", 2018-02-19
@Lynn

I suspect that instead Btn.onclick(checkResult());ofBtn.onclick(checkResult);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question