Symbols in JavaScript: how to use in real life?

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024

ความคิดเห็น • 7

  • @НатальяГорбунова-ю5ю
    @НатальяГорбунова-ю5ю ปีที่แล้ว

    👍

  • @scb-spacecryptobubbles7741
    @scb-spacecryptobubbles7741 ปีที่แล้ว +1

    Amazing work you did!

  • @rost-st
    @rost-st ปีที่แล้ว +1

    Nice!

  • @flyingbutter6759
    @flyingbutter6759 ปีที่แล้ว +2

    That’s amazing, I will watch your video 7.5 times and I will report it, thank you

  • @TimFedorchuk
    @TimFedorchuk ปีที่แล้ว +1

    Wow, thanks for the video! Interesting topic.
    Are there any other useful properties like "Symbol.iterator"? Maybe something you personally recommend or use on a daily basis?

    • @alexey_horbunov
      @alexey_horbunov  ปีที่แล้ว +2

      Thank you for the comment.
      Hmm, what I would recommend to acquire is Symbol.asyncIterator for an overriding of iterating through async objects - developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator .
      Also Symbol.isConcatSpreadable which may help you override merging objects - developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/isConcatSpreadable.
      And the interesting symbol is Symbol.toPrimitive, which can override default behaviour of transforming objects to primitives - developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toPrimitive