Check if a readonly Map is empty.
Map
Time complexity: O(1)
Space complexity: O(1)
The Map to check
true if map is empty, false otherwise
true
map
false
isEmpty(new Map([1, 2, 3])); // false Copy
isEmpty(new Map([1, 2, 3])); // false
isEmpty(new Map()); // true Copy
isEmpty(new Map()); // true
Check if a Map is empty.
isEmpty(new Map([['a', 1], ['b', 2], ['c', 3]])); // false Copy
isEmpty(new Map([['a', 1], ['b', 2], ['c', 3]])); // false
Check if a readonly Set is empty.
Set
The Set to check
true if set is empty, false otherwise
set
isEmpty(new Set([1, 2, 3])); // false Copy
isEmpty(new Set([1, 2, 3])); // false
isEmpty(new Set()); // true Copy
isEmpty(new Set()); // true
Check if a Set is empty.
Check if a string is empty.
The string to check
true if string is empty, false otherwise
string
String
isEmpty('hello'); // false Copy
isEmpty('hello'); // false
isEmpty(''); // true Copy
isEmpty(''); // true
Check if a readonly array is empty.
The array to check
true if array is empty, false otherwise
array
Array
isEmpty([1, 2, 3]); // false Copy
isEmpty([1, 2, 3]); // false
isEmpty([]); // true Copy
isEmpty([]); // true
Check if an array is empty.
Check if an iterable is empty.
The iterable to check
true if iterable is empty, false otherwise
iterable
Iterable
Check if a readonly
Map
is empty.Time complexity: O(1)
Space complexity: O(1)