this is so cursed wtf, i had no idea localStorage and sessionStorage were a map and that these were equivalent. i feel like this api is too recent for this to be excusable? this makes implementing the Storage interface a pain in the ass, basically requiring a Proxy.
Ayush Singh ⚛’s Post
More Relevant Posts
-
#tldr : Think about a time when you found yourself wrestling with conflicting thoughts or emotions. Perhaps you were contemplating a major life decision, grappling with self-doubt, or reflecting on past experiences. In those moments of introspection, you engaged in a dialogue between your rational mind and your intuitive feelings—a conversation that revealed insights, uncertainties, and opportunities for growth. The interplay between "I" and "me" is not merely a philosophical concept but a deeply personal journey of self-discovery. It involves exploring your beliefs, values, and aspirations while acknowledging and understanding the emotions, fears, and doubts that shape your perceptions and decisions. Embracing this internal conversation with curiosity and compassion is essential for personal growth and well-being. It allows you to deepen your self-awareness, uncover hidden motivations, and cultivate a greater sense of authenticity in how you live and interact with the world. Moreover, this dialogue encourages empathy towards oneself and others. Recognizing that everyone experiences their own internal struggles and conflicts fosters a greater understanding of human complexity and resilience. It reminds us that vulnerability and self-reflection are not signs of weakness but essential components of emotional intelligence and personal development. Navigating the conversation between "I" and "me" requires patience and mindfulness. It involves creating space for introspection through practices such as journaling, meditation, or meaningful conversations with trusted friends or mentors. These practices provide opportunities to explore your thoughts and feelings with clarity and perspective, leading to deeper insights and informed decision-making. As you continue on your journey of self-discovery, remember that the dialogue between "I" and "me" is a dynamic process—an ongoing exploration of your identity, values, and evolving aspirations. Embrace the complexities of this internal conversation as opportunities for growth, learning, and self-acceptance. Ultimately, by nurturing a compassionate and authentic relationship with yourself, you empower yourself to navigate life's challenges with resilience and grace. Embrace the dialogue between "I" and "me" as a pathway to deeper self-understanding, personal fulfillment, and meaningful connections with others. Embrace introspection with openness and curiosity, knowing that each insight gained enriches your understanding of yourself and strengthens your ability to live authentically and compassionately in the world.
To view or add a comment, sign in
-
#JavaScript : 𝗗𝗲𝗲𝗽 𝗖𝗼𝗽𝘆𝗶𝗻𝗴 𝗢𝗯𝗷𝗲𝗰𝘁𝘀 𝘄𝗶𝘁𝗵 𝗗𝗮𝘁𝗲 𝗣𝗿𝗼𝗽𝗲𝗿𝘁𝗶𝗲𝘀 𝗶𝗻 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁: 𝗔 𝗠𝗮𝗻𝘂𝗮𝗹 𝗔𝗽𝗽𝗿𝗼𝗮𝗰𝗵 👇 When working with JavaScript, creating deep copies of objects can be a common requirement, especially when you want to ensure that changes to one object do not affect another. This need becomes more complex when your object includes properties with `Date` objects. The typical approach using `𝗝𝗦𝗢𝗡.𝗽𝗮𝗿𝘀𝗲(𝗝𝗦𝗢𝗡.𝘀𝘁𝗿𝗶𝗻𝗴𝗶𝗳𝘆(𝗼𝗯𝗷)) ` fails here as it converts `Date` objects to strings. In this post, we will explore how to manually deep copy an object, preserving `#Date` properties correctly. 🔶 𝗪𝗵𝘆 𝗡𝗼𝘁 𝗨𝘀𝗲 : `JSON.parse(JSON.stringify(obj))`? The `JSON.parse(JSON.stringify(obj))` method works well for simple objects but falls short with more complex ones: - Date Objects: Converted to strings. - Functions: Omitted entirely. - Undefined Values: Omitted. - Circular References: Cause errors. Due to these limitations, we need a more robust manual approach. 🔶 𝗠𝗮𝗻𝘂𝗮𝗹 𝗗𝗲𝗲𝗽 𝗖𝗼𝗽𝘆 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻 : The following function recursively copies all properties of an object, handling arrays and `Date` objects appropriately. 𝗖𝗛𝗘𝗖𝗞 𝗧𝗛𝗘 𝗜𝗠𝗔𝗚𝗘 𝟭 🔶 𝗛𝗼𝘄 𝗜𝘁 𝗪𝗼𝗿𝗸𝘀 : 1. Primitive Values: If `obj` is a primitive (string, number, etc.), it is returned directly. 2. Date Objects: A new `Date` object is created using the timestamp of the original. 3. Arrays: Each element is deep copied recursively. 4. Objects: Each property is deep copied recursively. 🔶 𝗘𝘅𝗮𝗺𝗽𝗹𝗲 𝗨𝘀𝗮𝗴𝗲 : Let's see this function in action with an example object: 𝗖𝗛𝗘𝗖𝗞 𝗧𝗛𝗘 𝗜𝗠𝗔𝗚𝗘 𝟮 🔶 𝗘𝘅𝗽𝗹𝗮𝗻𝗮𝘁𝗶𝗼𝗻 : - Primitive Properties: `name` and `age` are copied directly. - Date Properties: `birthDate` and `nested.prop2` are correctly copied as new `Date` instances. - Nested Objects: `nested` is copied recursively, ensuring all properties are accurately duplicated. 🔶 𝗖𝗼𝗻𝗰𝗹𝘂𝘀𝗶𝗼𝗻 : Deep copying objects in JavaScript, especially those containing `Date` properties, requires careful handling. While libraries like #Lodash provide convenient methods (`_.cloneDeep`), understanding how to manually implement a deep copy function can give you greater control and insight into the process. The manual approach outlined above ensures that all properties, including dates, are preserved correctly in the copied object. By implementing this function, you can avoid the pitfalls of `JSON.parse(JSON.stringify(obj))` and handle complex objects with confidence. Happy coding! ❣️
To view or add a comment, sign in
-
He is right. 💯
Engineering Specialist at Dassault Systèmes | Google Scholarship Recipient | Top 25 Innovator India | 1x AWS | 2x Azure | Author with 750k Views
🔸 Tailwind is the Bootstrap of 2024 Don't get me wrong, I'm not talking about technical aspects and features. My post aims to highlight the over-dependency of frontend developers on these libraries. In the 2010s, most of the developers didn't know how to create website layouts using HTML and CSS Grid, all they had to offer for UI development was Bootstrap In the 2020s, most of the developers don't know how to utilise grid, flexbox, props to create React custom components, they are heavily reliant on Tailwind or similar libraries to do the work Believe me, it's the small things that set a good developer apart from a capable one 💐 Don't ignore UI development, it's the basis and basics of Frontend Development, don't jump to using libraries without getting familiar with the vanilla tech #reactjs #softwaredevelopment #technology #userexperience #ig
To view or add a comment, sign in
-
#javascript : To simulate enums in JS, you can use an object. But I often prefer to use consts. To me, consts read better, are easier to use, and I don't have to use indian notation to give the enum object a unique name. Here's an example of both patterns.
To view or add a comment, sign in
-
JS Tip: How do you set a breakpoint on a concise arrow? Here's a few options. #javascript
To view or add a comment, sign in
-
#Javascript: POV: I wasn't able to solve it. 😊 Let's try this interview question.
To view or add a comment, sign in
-
99% of people don't ask good questions at the end of job interviews. 👇 Here are 7 questions everyone must ask: #Q1. Is there anything else I can elaborate on to ensure I’m the best choice? This open-ended question allows you to seal the deal by addressing any lingering questions, and double down on your unique strengths. Use this last chance to highlight 1-2 essential skills they need, that you can offer over the other candidates. This final impression most directly impacts hiring choices. #Q2. What doubts do you have about my qualifications for this role? This allows you to respond to any hesitations and remove roadblocks to a job offer. This flips the script to allow them to present any doubts, allowing you to address any concerns. Listen closely for hints on where your experience or skills don’t sync with their requirements. Remind them of your past successes handling similar challenges. #Q3. What are some of the skills and experiences you’re hoping the ideal candidate has, that we haven’t gotten a chance to talk about? This prompts them to call out must-have skills where you can make the case that you still check the boxes for. It also may expose where you lack “must have” skills, meaning you’re likely not getting an offer no matter how strong your credentials are. Listen closely to the experience they emphasize to calibrate your closing pitch. #Q4. Can you describe a typical day in this role? This question helps you understand the daily responsibilities and expectations of the position. Look for a clear and detailed description of the tasks and how they align with your skills and interests. #Q5. What key achievements would define success in the first 6-12 months? This will surface their current challenges and top priorities, where you can position yourself as qualified. It also defines what success looks like in their eyes for this role. The more their big wins align with your capabilities and interests, the better the culture fit. #Q6. How does this company handle internal promotions and career advancement? Growth potential is a major factor in job satisfaction and employee retention. Knowing the company's approach to internal promotions and career advancement will help you plan your career trajectory. Look for a company with a transparent promotion process and a clear path for career growth. The answer here reveals how invested they are in developing staff. A lack of structure could signal high turnover. #Q7. What are the biggest challenges I would face in the first 3 to 6 months if hired? This shows you are thinking beyond just getting the job and are preparing for long-term success. It also shows key areas where you may already have experience, to help overcome such challenges. Listen for details on the current top priorities and problems of the role you could help solve. If the challenges seem unrealistic or far outside your capabilities, it may be a red flag about culture fit.
To view or add a comment, sign in
-
#JavaScript: Understanding Event Propagation in JavaScript and How to Control It 👇 Event propagation is a fundamental concept in JavaScript that allows events to flow through the DOM. When an event occurs, it can "propagate" through the document in three phases: capturing, target, and bubbling. Understanding these phases and knowing how to control event propagation can help you manage how events interact with different elements on your page. ✨ 𝗪𝗵𝗮𝘁 𝗶𝘀 𝗘𝘃𝗲𝗻𝘁 𝗣𝗿𝗼𝗽𝗮𝗴𝗮𝘁𝗶𝗼𝗻? When an event is triggered in the DOM, it goes through the following phases: 1. 𝗖𝗮𝗽𝘁𝘂𝗿𝗶𝗻𝗴 𝗣𝗵𝗮𝘀𝗲: The event travels from the root of the DOM tree down to the target element. 2. 𝗧𝗮𝗿𝗴𝗲𝘁 𝗣𝗵𝗮𝘀𝗲: The event reaches the target element where it was triggered. 3. 𝗕𝘂𝗯𝗯𝗹𝗶𝗻𝗴 𝗣𝗵𝗮𝘀𝗲: The event bubbles up from the target element back to the root. By default, most events in JavaScript bubble up after being triggered. This means that an event on a child element can also trigger event handlers on its parent elements. ✨𝗪𝗵𝘆 𝗖𝗼𝗻𝘁𝗿𝗼𝗹 𝗘𝘃𝗲𝗻𝘁 𝗣𝗿𝗼𝗽𝗮𝗴𝗮𝘁𝗶𝗼𝗻? There are situations where you might want to stop the propagation of an event to prevent it from triggering handlers on parent elements. This is particularly useful in complex UIs where multiple elements might have overlapping event handlers. ✨ 𝗛𝗼𝘄 𝘁𝗼 𝗦𝘁𝗼𝗽 𝗘𝘃𝗲𝗻𝘁 𝗣𝗿𝗼𝗽𝗮𝗴𝗮𝘁𝗶𝗼𝗻 You can stop event propagation using two main methods: 1. `𝗲𝘃𝗲𝗻𝘁.𝘀𝘁𝗼𝗽𝗣𝗿𝗼𝗽𝗮𝗴𝗮𝘁𝗶𝗼𝗻()` : This method stops the event from bubbling up the DOM tree. 2. `𝗲𝘃𝗲𝗻𝘁.𝗽𝗿𝗲𝘃𝗲𝗻𝘁𝗗𝗲𝗳𝗮𝘂𝗹𝘁()` : This method prevents the default action associated with the event but does not stop propagation. Often used together with `stopPropagation` for complete control. Here's a quick #example to illustrate how you can stop event propagation in vanilla JavaScript: 𝗖𝗛𝗘𝗖𝗞 𝗧𝗛𝗘 𝗜𝗠𝗔𝗚𝗘 In this example: - Clicking on the child element will log "Child clicked" to the console. - Because `event.stopPropagation()` is called in the child element's click handler, the click event will not propagate to the parent element, so "Parent clicked" will not be logged. ✨𝗕𝗲𝘀𝘁 𝗣𝗿𝗮𝗰𝘁𝗶𝗰𝗲𝘀 - 𝗨𝘀𝗲 𝗣𝗿𝗼𝗽𝗮𝗴𝗮𝘁𝗶𝗼𝗻 𝗖𝗼𝗻𝘁𝗿𝗼𝗹 𝗦𝗽𝗮𝗿𝗶𝗻𝗴𝗹𝘆 : Stopping event propagation can sometimes lead to unexpected behavior, especially in complex applications. Use it sparingly and document why it's necessary. - 𝗖𝗼𝗻𝘀𝗶𝗱𝗲𝗿 𝗘𝘃𝗲𝗻𝘁 𝗗𝗲𝗹𝗲𝗴𝗮𝘁𝗶𝗼𝗻 : Instead of attaching event listeners to many child elements, consider attaching a single event listener to a common ancestor element and using logic to handle events for specific child elements. Understanding and controlling event propagation is crucial for building interactive and efficient web applications. By mastering these techniques, you can create more predictable and maintainable code.
To view or add a comment, sign in
GET@Jio Platforms Limited. I am proficient on JavaScript, ReactJS, NextJS, TypeScript, Zustand.
1moThis is crazy