I need to retrieve nth weekday of the current date in js. like 1st Sunday, 2nd Sunday

var d=new Date();
var weekDay=d.getDay();

here weekDay gives me 4 that means its Wednesday(3rd Wednesday). So far its good.

from weekDay i can say that its wednesday.

how to calcuate the "3rd" index of this wednesday? 

Thank you