I'm a new dev looking for guidance. I'm writing out an AWS Lambda function for the purpose of array validation. Say I have the first array of
{"food":"ribs", "snacks":"doritos", "drinks":"pepsi"}
and the second array of
{
"answer": {
"food": [
"ribs",
"pasta",
"ramen"
],
"snacks": [
"doritos",
"cheetos",
"popcorn"
],
"drinks": [
"orange juice",
"apple juice"
]
}
}
How do I do validation on the first array using the correct answers on the second array?
The validation should return {"true","true","false"}
I'm getting confused on how to start/what method to approach
Any advice is appreciated
You need to lop for the answer key and check with
hasOwnProperty()function as follow: