To count JavaScript array objects, we’re using Object.prototype.__proto__ property.
Example
You can try to run the following code to count array objects −
<html>
<head>
<title>JavaScript Clone Date</title>
</head>
<body>
<script>
var len = 0;
var myArr = [{"Hello World!":"Welcome!","int":10},{"Learn":"Share","int":20},{"Tutorials":"Quiz","int":30}];
myArr.forEach(function(val){
if(!val.__proto__.__proto__){
len++;
}
});
document.write("Total Objects: "+len);
</script>
</body>
</html>Output
Total Objects: 3