You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// usage in IF statement
if (Object.keys(obj).length) {
// ...
}
note: in most case isEmptyObject is used in IF statement. Object.keys returns array. array.length is always number. 0 is converted to false, otherwise true. there is no need to create function in order to replace isEmptyObject.
The text was updated successfully, but these errors were encountered:
one-liner statement is more attractive than multi-liner, and closer to jquery style.
also:
All previous siblings (bare statemant):
[...el.parentNode.children].filter((item, idx, self) => idx < self.indexOf(el) && item.matches($selector))
All next siblings (bare statemant):
[...el.parentNode.children].filter((item, idx, self) => idx > self.indexOf(el) && item.matches($selector))
FadeToggle (ternary operator):
el.style.opacity = (opacity === "1") ? "0" : "1";
isEmptyObject (a pragmatic way):
note: in most case isEmptyObject is used in IF statement.
Object.keys
returns array.array.length
is always number. 0 is converted to false, otherwise true. there is no need to create function in order to replace isEmptyObject.The text was updated successfully, but these errors were encountered: