Artwork

Wes Bos and Scott Tolinski - Full Stack JavaScript Web Developers에서 제공하는 콘텐츠입니다. 에피소드, 그래픽, 팟캐스트 설명을 포함한 모든 팟캐스트 콘텐츠는 Wes Bos and Scott Tolinski - Full Stack JavaScript Web Developers 또는 해당 팟캐스트 플랫폼 파트너가 직접 업로드하고 제공합니다. 누군가가 귀하의 허락 없이 귀하의 저작물을 사용하고 있다고 생각되는 경우 여기에 설명된 절차를 따르실 수 있습니다 https://ko.player.fm/legal.
Player FM -팟 캐스트 앱
Player FM 앱으로 오프라인으로 전환하세요!

Hasty Treat - A Podcast About Nothing

15:01
 
공유
 

Manage episode 282013139 series 1469447
Wes Bos and Scott Tolinski - Full Stack JavaScript Web Developers에서 제공하는 콘텐츠입니다. 에피소드, 그래픽, 팟캐스트 설명을 포함한 모든 팟캐스트 콘텐츠는 Wes Bos and Scott Tolinski - Full Stack JavaScript Web Developers 또는 해당 팟캐스트 플랫폼 파트너가 직접 업로드하고 제공합니다. 누군가가 귀하의 허락 없이 귀하의 저작물을 사용하고 있다고 생각되는 경우 여기에 설명된 절차를 따르실 수 있습니다 https://ko.player.fm/legal.

In this Hasty Treat, Scott and Wes talk about nothing — null, undefined, void, false, 0, ‘’, NaN, [], {}, never — all sorts of values that could mean the things that do not exist.

Prismic - Sponsor

Prismic is a Headless CMS that makes it easy to build website pages as a set of components. Break pages into sections of components using React, Vue, or whatever you like. Make corresponding Slices in Prismic. Start building pages dynamically in minutes. Get started at prismic.io/syntax.

LogRocket - Sponsor

LogRocket lets you replay what users do on your site, helping you reproduce bugs and fix issues faster. It’s an exception tracker, a session re-player and a performance monitor. Get 14 days free at logrocket.com/syntax.

Show Notes

03:35 - Undefined

  • Implicitly nothing
  • A variable declared, but not set is undefined

04:25 - Null

  • Explicitly nothing

04:41 - Null vs Undefined

  • Null has a value of nothing
  • Undefined does not have a value
  • You can set variables to either
    • If you want to set a score variable to nothing, set it to null
    • If you want to un-set a value, set it to undefined
    • == will check if a value is either null or undefined

05:35 - Void

  • In Javascript
    • You can pop void in front of calling a function and it will return undefined (even if that function returns a value)
    • I’ve seen it on links that go nowhere (don’t do this — use a button)
    • To prevent an arrow function from leaking
    • onSubmit="javascript:void()" is a quick-n-easy prevent default on forms
  • In Typescript
    • Void is when you don’t care about what is returned from a function, or if nothing is returned
    • A click handler that goes off and does stuff (side effect) can return void

09:15 - Never (in Typescript)

  • Some functions will never return:
    • Functions that throw errors
    • Functions that have infinite loops
    • Also, unreachable variables have a type of never
      • if(true == false) { let var = 'this will never be true'; }

11:05 - Falsy values

  • 0, -0, 0n
  • false
  • ‘’ (empty string)
  • Empty array
    • Is a value
    • Its .length can be falsy
  • Empty object
    • Is a value
    • Its object.keys(object) length can be falsy (0)
Tweet us your tasty treats!
  continue reading

773 에피소드

Artwork
icon공유
 
Manage episode 282013139 series 1469447
Wes Bos and Scott Tolinski - Full Stack JavaScript Web Developers에서 제공하는 콘텐츠입니다. 에피소드, 그래픽, 팟캐스트 설명을 포함한 모든 팟캐스트 콘텐츠는 Wes Bos and Scott Tolinski - Full Stack JavaScript Web Developers 또는 해당 팟캐스트 플랫폼 파트너가 직접 업로드하고 제공합니다. 누군가가 귀하의 허락 없이 귀하의 저작물을 사용하고 있다고 생각되는 경우 여기에 설명된 절차를 따르실 수 있습니다 https://ko.player.fm/legal.

In this Hasty Treat, Scott and Wes talk about nothing — null, undefined, void, false, 0, ‘’, NaN, [], {}, never — all sorts of values that could mean the things that do not exist.

Prismic - Sponsor

Prismic is a Headless CMS that makes it easy to build website pages as a set of components. Break pages into sections of components using React, Vue, or whatever you like. Make corresponding Slices in Prismic. Start building pages dynamically in minutes. Get started at prismic.io/syntax.

LogRocket - Sponsor

LogRocket lets you replay what users do on your site, helping you reproduce bugs and fix issues faster. It’s an exception tracker, a session re-player and a performance monitor. Get 14 days free at logrocket.com/syntax.

Show Notes

03:35 - Undefined

  • Implicitly nothing
  • A variable declared, but not set is undefined

04:25 - Null

  • Explicitly nothing

04:41 - Null vs Undefined

  • Null has a value of nothing
  • Undefined does not have a value
  • You can set variables to either
    • If you want to set a score variable to nothing, set it to null
    • If you want to un-set a value, set it to undefined
    • == will check if a value is either null or undefined

05:35 - Void

  • In Javascript
    • You can pop void in front of calling a function and it will return undefined (even if that function returns a value)
    • I’ve seen it on links that go nowhere (don’t do this — use a button)
    • To prevent an arrow function from leaking
    • onSubmit="javascript:void()" is a quick-n-easy prevent default on forms
  • In Typescript
    • Void is when you don’t care about what is returned from a function, or if nothing is returned
    • A click handler that goes off and does stuff (side effect) can return void

09:15 - Never (in Typescript)

  • Some functions will never return:
    • Functions that throw errors
    • Functions that have infinite loops
    • Also, unreachable variables have a type of never
      • if(true == false) { let var = 'this will never be true'; }

11:05 - Falsy values

  • 0, -0, 0n
  • false
  • ‘’ (empty string)
  • Empty array
    • Is a value
    • Its .length can be falsy
  • Empty object
    • Is a value
    • Its object.keys(object) length can be falsy (0)
Tweet us your tasty treats!
  continue reading

773 에피소드

Minden epizód

×
 
Loading …

플레이어 FM에 오신것을 환영합니다!

플레이어 FM은 웹에서 고품질 팟캐스트를 검색하여 지금 바로 즐길 수 있도록 합니다. 최고의 팟캐스트 앱이며 Android, iPhone 및 웹에서도 작동합니다. 장치 간 구독 동기화를 위해 가입하세요.

 

빠른 참조 가이드