I spent a long time looking how to get random values from both objects and arrays, but I can't seem to discern how to pull this off. I have this code, which will house up to a hundred different reviews with credentials corresponding. How can I a) Pull a random set of four reviews with all corresponding data every time the page refreshes (must be unique) b) Post those reviews in HTML/CSS via DOM
Here's the base code:
var reviews = [
{
content: "content of review", // no need to have html there even.
by: "name of reviewer or initials",
stars: 5, // default, no need to specify to every item
source: "Google Play", // default, no need to specify to every item
},
{
content: "content of review", // no need to have html there even.
by: "name of reviewer or initials",
stars: 5, // default, no need to specify to every item
source: "Google Play", // default, no need to specify to every item
},
etc.etc
];