Generate 4 digit Pin using javascript

I want to create random 4 digit PIN on my website. But I am not sure how to do it. Can anyone help!!