JSFiddle - React, Tailwind, and code Playground

by Ian Sanders

JavaScript

$.getJSON("http://api.stackexchange.com/2.2/questions/269754/answers/?order=desc&site=meta.stackoverflow&callback=?", function (data) {
        var originalScore;
        $.each(data.items, function (i, v) {
            if (v.answer_id == 270111) {
                originalScore = v.score;
                return;
            }
        });
        
        console.log(originalScore);

        function test() {
            $.getJSON("http://api.stackexchange.com/2.2/questions/269754/answers/?order=desc&site=meta.stackoverflow&callback=?", function (data) {
                var listingTitle = data.items[0].answer_id;
                var score = 0;
                $.each(data.items, function (i, v) {
                    if (v.answer_id == 270111) {
                        score = v.score;
                        return;
                    }
                });
                console.log(score);
                setTimeout(function () {
                    test();
                }, 5000);
            });
        }
        test();
    });