With 2 arrays (one of numbers and other of objects),
How can I get a specific object's-(size) value (in other function) without knowing its index (and it's value) in the array only its key
with the shortest and fastest way so I can use that value number ?
If the array is empty except for this specific object, the size property value will be - 0;
If my question isn't clear please comment and I'll fix it and make it betters.
let firstArray = [ 1, 2 , 10, 23, {size: 890}];
funcExtract(firstArray);
function funcExtract(arr){
// arr ? How to find the object when knowing only its key
}
And with array of objects
let secondArray = [ {a:2}, {b:4 },{size: 700}, {c:5} ];
funcExtract(secondArray);
function funcExtract(arr){
}
reactjsfrom the post tags. It's not relevant for what you're asking.sizeproperty. What is the "specific object" you're looking for? Can you give some examples?keyis "size", and thevalueis 890