File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 487
487
2722|[ Join Two Arrays by ID] ( ./2722-join-two-arrays-by-id.js ) |Medium|
488
488
2723|[ Add Two Promises] ( ./2723-add-two-promises.js ) |Easy|
489
489
2724|[ Sort By] ( ./2724-sort-by.js ) |Easy|
490
+ 2727|[ Is Object Empty] ( ./2727-is-object-empty.js ) |Easy|
490
491
3042|[ Count Prefix and Suffix Pairs I] ( ./3042-count-prefix-and-suffix-pairs-i.js ) |Easy|
491
492
3110|[ Score of a String] ( ./3110-score-of-a-string.js ) |Easy|
492
493
3223|[ Minimum Length of String After Operations] ( ./3223-minimum-length-of-string-after-operations.js ) |Medium|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 2727. Is Object Empty
3
+ * https://leetcode.com/problems/is-object-empty/
4
+ * Difficulty: Easy
5
+ *
6
+ * Given an object or an array, return if it is empty.
7
+ *
8
+ * - An empty object contains no key-value pairs.
9
+ * - An empty array contains no elements.
10
+ *
11
+ * You may assume the object or array is the output of JSON.parse.
12
+ */
13
+
14
+ /**
15
+ * @param {Object|Array } obj
16
+ * @return {boolean }
17
+ */
18
+ var isEmpty = function ( obj ) {
19
+ return ! Object . keys ( obj ) . length ;
20
+ } ;
You can’t perform that action at this time.
0 commit comments