I see below code. And I just want to check if item.hasOwnProperty(key) is not helpful at all? My reason is that because we use for (let in), so we get every key in the object, and we do not need to check if this key is in the object. Am I right?
public convertObjectKeyToArray(item) {
let array = [];
for (let key in item) {
if (item.hasOwnProperty(key)) {
arr.push(key);
}
}
return array;
}