Sondip kumar’s Post

🚀 Learning Update: Stack Implementation in JavaScript Today I practiced building a Stack data structure from scratch using JavaScript! It follows the LIFO (Last In, First Out) principle — just like a stack of books 📚 The last element added is always the first one removed. Here’s a snippet of my implementation 👇 class Stack {  constructor() {   this.items = [];  }  push(value) {   this.items.push(value);  }  pop() {   if (this.items.length === 0) return undefined;   return this.items.pop();  }  peek() {   return this.items[this.items.length - 1];  } } 🧠 What I learned: How push() and pop() work under the hood Why Stack is useful for undo operations, recursion, and function calls Practiced logical thinking and abstraction Next, I’m going to learn Queue — can’t wait to explore FIFO logic! 💻 #JavaScript #DataStructures #Stack #CodingJourney #WebDevelopment

To view or add a comment, sign in

Explore content categories