isEmpty({}) //true
    isEmpty(‘’) //true
    isEmpty([]) //true

    1. function isEmpty(x) {
    2. if(Array.isArray(x) || typeof x === 'string' || x instanceof String) {
    3. return x.length === 0;
    4. }
    5. if(x instanceof Map || x instanceof Set) {
    6. return x.size === 0;
    7. }
    8. if(({}).toString.call(x) === '[object Object]') {
    9. return Object.keys(x).length === 0;
    10. }
    11. return false;
    12. }