Tell us what’s happening:
I’ve modified this assignment to a Random Dog Quoting Machine. I have a variable array below, and a number generator function. Then, I return my dogQuote. Not working.
To start, I just want to get this to work. I tried running it in CodePen.io. I get the follwing error:
index.js: Unexpected token, expected , (20:22)
Not sure what to do.
Your code so far
// Dog Quoting Machine
var arr1 = [ // create a const/var array with multiple dogs and dog-properties
{
"id": "1",
"dogName": "Lassie",
"dogQuote": "That Timmy couldn't do Anything without me!",
"dogType": "Collie",
"Movie": "Lassie",
},
{
"id": "2",
"dogName": "Rin-Tin-Tin",
"dogQuote": "Life at the Fort was Not Always Easy",
"dogType": "German Shepherd",
"Movie": "The Adventures of Rin-Tin-Tin",
},
{
"id": "3",
"dogName": Sargeant Preston",
"dogQuote": "I would rather be going to Southern California than the Yukon."
"dogType": "German Shepherd/Wolf",
"Movie": "Sargeant Preston of the Yukon",
},
{
"id": "4",
"dogName": "dogName4",
"dogQuote": "dogQuote4",
"dogType": "dogType4",
"Movie": "Movie4",
},
];
function quoteRandomizer(min,max){ //use a quote Randomizer to select a dog in the array.
return Math.floor(Math.random() * (max - min + 1)) + min;
}
var randNum = quoteRandomizer (0,4); // draw your lucky dog-Winner!
return arr1[randNum][dogQuote]; // return lucky dog-Winner's quote!
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/front-end-libraries-projects/build-a-random-quote-machine