background preloader

Javascript

Facebook Twitter

Exploring JavaScript’s Logical OR Operator. In JavaScript, logical operators are used for boolean logic where a boolean value may be returned depending on the outcome of an expression.

Exploring JavaScript’s Logical OR Operator

With the || (OR) operator, since values don't need to be explicitly true or false (they can be truthy or falsy), the operator can return non-boolean results when evaluated. Introduction To understand the || operator, let's first look at a fairly basic example. JavaScript. JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles. Read more about JavaScript. This section is dedicated to the JavaScript language itself, and not the parts that are specific to Web pages or other host environments.