본문 바로가기

Python_WEB/JavaScript

[freecodecamp]JavaScript 불일치 연산자의 비교

반응형

완전 부등식 연산자 (! ==)는 완전 항등 연산자의 논리적 반대입니다.

이는 "Strictly Not Equal"을 의미하고 완전 동등성이 true를 반환하고 그 반대의 경우 false를 반환합니다.

엄격한 부등식은 데이터 유형을 변환하지 않습니다.

 

예>

3 !==  3   // false
3 !== '3'  // true
4 !==  3   // true

 

Q>

1. val이 17과 같지 않을 때 함수가 "Not Equal"을 반환하도록 if 문에 엄격한 부등식 연산자를 추가합니다.

2. testStrictNotEqual (17)은 "Equal"을 반환해야합니다.

3. testStrictNotEqual ( "17")은 "Not Equal"을 반환해야합니다.

4. testStrictNotEqual (12)는 "Not Equal"을 반환해야합니다.

5. testStrictNotEqual ( "bob")은 "Not Equal"을 반환해야합니다.

6. !== 연산자를 사용해야합니다.

 

A>

// Setup
function testStrictNotEqual(val) {
    if (val !== 17) {
        // Change this line
        return 'Not Equal';
    }
    return 'Equal';
}

console.log(testStrictNotEqual(10));

 

https://www.freecodecamp.org

 

freeCodeCamp.org

Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.

www.freecodecamp.org

 

반응형