This is actually fairly simple:
var yesterday = new Date(new Date().getTime() - (24 * 60 * 60 * 1000));
Simply construct a new Date with the value of the current timestamp minus 24 hours.
(24 hours multiplied by 60 minutes in each hour multiplied by 60 seconds in each minute multiplied by 1000 milliseconds in each second)