---
title: "复杂 与或 逻辑 javascript"
author: "p2world"
date: "2012-02-20T14:51:38Z"
tags: []
categories: ["编程语言"]
slug: "javascript"
draft: false
lastmod: "2012-02-21T16:19:55Z"
id: 1413574
url: "https://p2world.iteye.com/blog/1413574"
---

&&和||都是短路运算符：

A&&B：若A为真，返回B
A&&B：若A为假，返回A

A||B：若A为真，返回A
A||B：若A为假，返回B

A||B||C 计算顺序从左到右。相当于（A||B)||C

A&&B||C的值：

<span style="color:red">AB全为真返回B，否则返回C</span>