Determining number of line items in quote

I’m writing some custom javascript that will update the list price field based on a drop-down that the user selects. However, I would need to figure out how many groups and line items there are in order to cycle through them and update all list price text fields.

is there an easy way to determine the number of rows?