🔄 undefinedToNull Utility
Category: js / utils
Difficulty: medium
Here's a clearer explanation of the undefinedToNull function with test cases. ✅ Implementation [code example] Explanation: Check if the input is an object : If obj is not an object or is null, it returns the input unchanged. Handle Arrays : If obj is an array (Array.isArray(obj)), it recursively calls undefinedToNull on each element of the array using map. Handle Objects : For an object, the function creates a new object (result), iterates through the object properties, and recursively calls undefinedToNull on each property to handle potential nested structures. Recursive Call : The function handles any level of nesting (arrays within objects and objects within arrays). Test Cases: [code example] Key Features: Recursion : Handles deeply nested arrays and objects. Handles undefined values : Replaces undefined values with null, while leaving other values intact. Preserves object structure : The function maintains the same structure (arrays within objects, objects within arrays)....