Thanks to visit codestin.com
Credit goes to developer.mozilla.org

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

불리언

컴퓨터 과학에서 불리언(boolean) 은 논리적인 데이터 유형입니다. 불리언은 참(true) 혹은 거짓(false) 값 만을 가질 수 있습니다.

Javascript에서 불리언 조건은 어떤 코드 부문이 실행되어야 할 지(예를 들어 if 절 안에서) 또는 어떤 코드 부문을 반복해야 할지(예를 들어 for 문 안에서) 결정하는 데 사용합니다.

아래는 불리언이 쓰일 수 있는 예시를 보여주는 유사코드입니다(실행 가능한 코드는 아닙니다).

js
/* JavaScript if문 */
if (boolean conditional) {
  // 조건이 참일 경우 실행되는 코드
}
if (boolean conditional) {
  console.log("boolean conditional resolved to true");
} else {
  console.log("boolean conditional resolved to false");
}
/* JavaScript for 루프 */
for (control variable; boolean conditional; counter) {
  // 조건이 참일 경우 반복해서 실행할 코드
}

불리언이란 이름은 기호 논리학 분야의 선구자인 영국 수학자 조지 불의 이름을 따왔습니다.

여기까지 일반적인 소개였습니다. The term 불리언이라는 용어는 문맥에 따라 더 구체적인 의미를 가질 수 있습니다. 다음을 읽어보세요.

Boolean (JavaScript)
JavaScript에서의 불리언true 또는 false일 수 있는 원시 값입니다.
Boolean attribute (ARIA)
ARIA의 불리언 속성은 열거 목록에 true 또는 false를 포함하는 열거 속성입니다.
Boolean attribute (HTML)
HTML의 불리언 속성true 또는 false일 수 있는 속성입니다.

같이 보기