Home / Javascript Tips Generated By ChatGPT / Understanding Default Values with Logical OR (||) in Javascript Use the logical OR operator to set default values. Source Code let name = ""; let defaultName = name || "John Doe"; console.log(defaultName); // "John Doe"