Difference between document.ready and window.onload

Both document.ready and window.onload event is used to perform the action when webpage is loaded. What’s the difference between these two events.

The difference between document.ready and window.onload is most asked javascript interview question for both fresher and experienced web developers.