Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 1.83 KB

File metadata and controls

20 lines (14 loc) · 1.83 KB

IsEmpty medium #javascript #lodash

by null @albinAppsmith

Take the Challenge

Write a JavaScript function called isEmpty that takes a single argument and checks if it represents an empty object, collection, map, or set. The function should return true if the input is empty and false otherwise.

Example:

isEmpty({}); // true
isEmpty([]); // true
isEmpty(new Map()); // true
isEmpty(new Set()); // true

isEmpty({name: 'John'}); // false
isEmpty([1, 2, 3]); // false
isEmpty(new Map([['a', 1], ['b', 2]])); // false
isEmpty(new Set([1, 2, 3])); // false

Back Share your Solutions Check out Solutions