JSFiddle - React, Tailwind, and code Playground
by jasonwilczak
HTML
<div id="stuff"></div>
JavaScript
var input = ["Axel",
4,
4.21,
{name: 'Bob', age: 16},
{type: 'fish', model: 'golden fish'},
[1, 2, 3],
"John",
{name: 'Peter', height: 1.90}
];
var div = document.getElementById('stuff');
div.innerHTML = '<div>input length='+input.length+'</div>';
div.innerHTML += '<div>filtering...</div>';
input = input.filter(function (e) {
return (typeof e === 'object') && !Array.isArray(e);
});
setTimeout(function(){div.innerHTML += '<div>input length='+input.length+'</div>';
},500);
/*
[
{"name": "Bob", "age": 16},
{"type": "fish", "model": "golden fish"},
{"name": "Peter", "height": 1.9}
]
*/