I have a script that console logs the following:
console.log(this.props.comments);
console.log(Object.keys(this.props.comments)); //why length 0???
The output:
If this.props.comments
has a child node and that it console.logs correctly, why does Object.keys console log an empty array? This is really stumping me. I use Object.keys quite a lot and I have never come across this before. I am expecting the second console.log to output: ["AFIFAIFJJ"]
I am hoping that I am doing something rather stupid! All help is appreciated. Thanks in advance.
p.s. I am using React-Native although, the question is just regarding Javascript I believe.