Skip to content

Instantly share code, notes, and snippets.

@alexgodin
Created July 17, 2020 15:50
Show Gist options
  • Save alexgodin/a189f92b08fc0ab01d455d61ff1aab51 to your computer and use it in GitHub Desktop.
Save alexgodin/a189f92b08fc0ab01d455d61ff1aab51 to your computer and use it in GitHub Desktop.
const feedback_types = ["Postive", "Neutral", "Negative"]
const feedback_array = [{
first_name:"Dayrell",
type:"Positive",
body:"Great",
date:"2020-07-16T16:56:36.847875"
}]
// THIS RETURNS NOTHING
feedback_types.map((ftype) => {
return feedback_array.filter((x) => x.type == ftype)
})
// THIS RETURNS SOMETHING
feedback_types.map((ftype) => {
return feedback_array.filter((x) => x.type == "Positive")
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment