Faisal Akbar
banner
faisalakbar.bsky.social
Faisal Akbar
@faisalakbar.bsky.social
Full Stack Problem Solver | Data Storyteller in the making | Tech explorer bridging ideas and implementation
Currently @ Bank of America
Blogging @ dsfaisal.com
Common use cases for stacks include:
- Function call management (call stack)
- Undo/Redo operations
- Expression evaluation
- Browser history
- Syntax parsing
January 5, 2025 at 10:47 PM
The implementation I provided includes all basic stack operations:
- push(): Add element to top
- pop(): Remove and return top element
- peek(): View top element without removing
- isEmpty(): Check if stack is empty
- getSize(): Get number of elements
- clear(): Remove all elements
January 5, 2025 at 10:47 PM
Implementation of stack using JavaScript:
January 5, 2025 at 10:47 PM
Key characteristics of a stack:
- Items can only be added/removed from one end (the top)
- The last element added is the first one to be removed
- Access to elements in the middle is not allowed
January 5, 2025 at 10:47 PM
Key benefits:
● Building reusable components with default styles
● Allowing style overrides via props
● Handling conditional classes
● Ensuring Tailwind classes don't conflict
January 2, 2025 at 8:44 PM
Here's a practical example:
January 2, 2025 at 8:44 PM
December 28, 2024 at 12:31 AM
It depends, useEffect without deps is perfectly fine if you're not updating state. It will run after every render - that's sometimes exactly what you want. Here are some example:
December 28, 2024 at 12:10 AM
It’s simple, you just need to understand what and when to use dependencies:
December 27, 2024 at 5:51 PM
Yes those are most common use cases.
December 26, 2024 at 6:47 PM