JSFiddle - React, Tailwind, and code Playground

by alexdickson

JavaScript

var arr = [
    {
    a: 'a',
    b: 'b'},
{
    c: 'c'},
{
    d: 'd',
    e: 'e'},
{
    a: 'a',
    b: 'b'}
];

var uniqueProperties = [];

for (var i = 0, length = arr.length; i < length; i++) {
    for (var prop in arr[i]) {
       if (arr[i].hasOwnProperty(prop) && uniqueProperties.indexOf(prop) === -1) {
            uniqueProperties.push(prop);
        }
    }

}

var uniquePropertiesLength = uniqueProperties.length;

document.body.innerHTML = uniquePropertiesLength + ' unique properties.'