Best practice: Truthy and falsy values in JavaScript

The following example shows how the types of functions and objects can be used to detect the capability of a web browser. The example shows the detection of the WebRTC functionality in a standard way and then uses the ternary operator and the behaviour of truthy and falsy values to refactor the code. The business logic is written in a self-executing function.
Best practice: Truthy and falsy values in JavaScript weiterlesen