What are alternatives to nullish coalescing?

Alternatives to Nullish Coalescing

Nullish coalescing allows developers to define default values when dealing with null or undefined variables. However, there are several alternatives to achieving similar functionality in JavaScript. In this article, we will explore some of those alternatives.
Keywords: JavaScript, Nullish Coalescing, Default Values, Alternatives, Coding Practices
            // Using the OR (||) operator
            let value = userInput || defaultValue;

            // Using the ternary operator
            let value = (userInput !== null && userInput !== undefined) ? userInput : defaultValue;

            // Using logical nullish assignment (??=)
            userInput ??= defaultValue;
        

Keywords: JavaScript Nullish Coalescing Default Values Alternatives Coding Practices