Execute jQuery only if cell in same column has text/nr in certain row

I want to run this:

$("table.swexc-cup-sam td:nth-child(n+5):nth-child(-n+11):empty").text("-");

But only if the cell in same column in the second row (first below thead) has text/string/nr (example 100, 88, 80 or a another nr).

The row I want to check always has the class row-2 assigned to it and it’s between column 5 and 11.
Tried to Google it, but not sure it’s even possible?

You can just have an if statement that checks for what you want, and if it passes, then run whatever code in that block.

How do I check if a cell in a row has that? Maybe my google skills sucks but don’t know what to look for.

Since you already have that cell defined by a class, you would do a check on the .row-2 class to see if it has a value, and if it does execute your code. I don’t know any jQuery so I can’t really help much on that part, but if/else statements are plain JS so you can incorporate that into jQuery.

I would recommend checking out this link as well for more of an understanding on if/else statements if you are unfamiliar with it https://www.w3schools.com/jsref/jsref_if.asp