If I had a json object that looks like this:
var json = {
red: 1,
blue: 2,
green: 3
}
and would like to get two arrays, one of the keys [red, blue, green] and one for the values [1, 2, 3] without manually creating a forloop, is it possible?
I've done some research and found that Object.keys(json) gets back an array of the keys, but have not been able to find anything for values!
-edit- If an explanation can be provided as to why it has been marked as duplicate, I've quite clearly specified I'd prefer a method not to use forloops, that would be nice.