In the first code, you calculate $('tr td') once and get a snippet.
In the second code, you calculate $('tr td') 4 times, and then extract from the 4th to 7th child each time.
Therefore, the first code runs faster. In fact, it is also easier to read.
source share