I need a dynamic table by javascript , which add row dynamically. But I need dynamic table will show latest four row .Older row will not show . I don't need more than four row.

Here is my code to display row:

$('#history').append('<tr><td>'+labordate+'</br>'+ formattedStart+'</td><td>'+formattedEnd+'</td><td>'+lengthFormatted+'</td><td>'+timeBetweenFormatted+'</td></tr>')


Thanks