JavaScript: implementare il metodo isEmptyObject() di jQuery
In questo articolo vedremo come implementare il metodo isEmptyObject() di jQuery in JavaScript.
In questo articolo vedremo come implementare il metodo isEmptyObject() di jQuery in JavaScript.
La soluzione รจ la seguente:
'use strict';
const isEmptyObject = obj => {
if(typeof obj !== 'object' || obj === null) {
return false;
}
return JSON.stringify(obj) === '{}';
};
Commenti