JSFiddle - React, Tailwind, and code Playground

by Hüseyin BABAL

HTML

<ul>
    <li class="name 1">asd<li>
    <li class="name 2">asddasdad<li>
</ul>

JavaScript

var temp = 13
$('.name').each(function () {
            //name = this;



            //console.log(temp)

            if (($(this).hasClass("1") == true)) {

                //console.log("you in1")
                //console.log(temp);
                if (temp > 10 && temp <= 20) {
                    temp = temp + 10;
                    //console.log(temp);
                    //Agriculture.push(10);
                } else {
                    temp = temp + 5;
                    //console.log(temp);
                    //Agriculture.push(5);
                }
                //return temp;
                console.log(temp);
                alert("You are in first if and temp = " + temp);

            }

            if (($(this).hasClass("2") == true)) {

                console.log("you in2")
                
                if (temp > 10 && temp <= 20) {
                    console.log(temp);
                    temp = temp + 10;
                    //Industry.push(10);
                } else {
                    temp = temp + 5;
                    //Industry.push(5);
                }
                //return temp;
                alert("You are in second if and temp = " + temp);
                
            }
});