How to create Event Emitter in JS | Asked in Meta, Microsoft | JS Coding | DSA in JavaScript

Поделиться
HTML-код
  • Опубликовано: 24 ноя 2024

Комментарии • 19

  • @sourav_singh_diaries
    @sourav_singh_diaries  4 месяца назад +1

    Can you guess the time complexity of both “subscribe” and “emit” functions ? How can you improve it

    • @s2sengar
      @s2sengar 3 месяца назад

      For improvement we can use map of map i.e. create a map for of eventName which will have a new map of callbacks as it's value.
      The value for map of callback will be no.of time the callback is used for that particular event.
      Current Time complexity
      Subscribe : O(1)
      Release : O(n)
      Emit : O(n)
      n= no of callbacks for a particular event

    • @sourav_singh_diaries
      @sourav_singh_diaries  3 месяца назад

      @@s2sengar Sounds perfect

  • @AdityaRaj-lj5wf
    @AdityaRaj-lj5wf 3 месяца назад

    awesome, waiting for more ❤

  • @dipaksaha6629
    @dipaksaha6629 4 месяца назад +1

    amazing video...waiting for the next ones..

  • @akashddeepchitransh4537
    @akashddeepchitransh4537 3 месяца назад

    Hi Sourav,
    Are you sure that you will be completing this series?
    I mean if you have planned to push videos in this series consistently, I can make a schedule to watch your video as soon as it comes.
    Actually I have a full time job also so I need to plan it accordingly.
    I don't want to ask you more but if we can know how many days this series will take ?

    • @sourav_singh_diaries
      @sourav_singh_diaries  3 месяца назад

      @@akashddeepchitransh4537 Every week you can expect ~2 videos on this. Thats the pace I can promise. Because I have a full time job as well.
      Hope this helps

    • @sourav_singh_diaries
      @sourav_singh_diaries  3 месяца назад

      And this much I can promise that I will be completing this series

    • @akashddeepchitransh4537
      @akashddeepchitransh4537 3 месяца назад

      @@sourav_singh_diaries Yes definitely it helps Sourav.
      I'll be following this series consistently. And thanks for the response 🙂

  • @harshaha1719
    @harshaha1719 4 месяца назад

    Sir, I completed my BCA in August. Sir, I have pretty good knowledge on the front end. Sir, please provide what type of project I should do and one more thing: how to build an online connection through LinkedIn or X.

    • @sourav_singh_diaries
      @sourav_singh_diaries  4 месяца назад

      This is pretty complicated question but you should try to create clones like Giphy, Netflix etc if you are a beginner.
      Otherwise do some more valuable projects like building a real time video call app, Chat app, build cool frontend widgets like e.g When you hover over a player seekbar, you see a frame of image related to that timestamp, Image carousels.

    • @harshaha1719
      @harshaha1719 4 месяца назад

      Thank you so much sir ​@@sourav_singh_diaries

  • @llegenda-r3c
    @llegenda-r3c 4 месяца назад

    Sir I have completed JavaScript tutorial now can I have to do project or js question 🙏🙏🙏🙏🙏🙏🙏🙏 pls reply

  • @jhonsnow534
    @jhonsnow534 4 месяца назад

    bro ye series AtoZ complete kr dena plz

  • @nikitakumawat6365
    @nikitakumawat6365 4 месяца назад +1

    O(n)