Coder Social home page Coder Social logo

Comments (7)

EunkyoungJung avatar EunkyoungJung commented on May 31, 2024 5

테스트를 해봤는데,
0 == false // true
'' == false // true

'' || 0 // 출력결과 0
0 || '' // 출력결과 ''

결론적으로, falsy || falsy이면 두번째 falsy가 출력되네요!
둘중에 하나로 참이면 참이기 때문에,
첫번째가 거짓이더라도 두번째가 참이면 참일 수 있어서,
두번째까지 확인하게 되어 있어서 그런 것 같습니다.

from learnjs.

AppleCEO avatar AppleCEO commented on May 31, 2024

마지막에 A 가 Falsy 할 때 B 도 Falsy 하면 B 는 출력되지 않을 것 같은데 확인 부탁드립니다!

from learnjs.

granen32 avatar granen32 commented on May 31, 2024

20210308

from learnjs.

Jibros avatar Jibros commented on May 31, 2024

22.03.22

from learnjs.

zuzubibi avatar zuzubibi commented on May 31, 2024

22.03.25

from learnjs.

serpiko-git avatar serpiko-git commented on May 31, 2024
// (2022 추천해요) Optional chaining and Nullish coalescing operator :)
const nameWithDog = {
 name: '멍멍이'
};

function getName(animal) {
  return animal?.name ?? '이름이 없는 동물입니다.';
}

console.log( getName() ); // 이름이 없는 동물입니다.
console.log( getName(nameWithDog) ); // 멍멍이

from learnjs.

studyToStudy avatar studyToStudy commented on May 31, 2024

22.08.18

from learnjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.