If I have an object
post = {
title: "Title",
image_1: "1234",
image_2: "2345"
}
and I want to get an array:
["1234", "2345"]
This is how I filter attributes to be included in the array
Object.keys(post).filter(key =>
key.includes("image")
);
and get an array of correct keys. How do I get values instead?
Object.valuesinstead ofObject.keys. Do you want a value based on the key or get all of the values fromincludesor something?Object.entriesand compare using the object's key