Programming ConceptsStack

A stack is a linear data structure that follows the Last In, First Out (LIFO) principle. It is commonly used in function calls, undo operations, and expression evaluation.

let stack = [];
stack.push(1);
stack.push(2);
console.log(stack.pop()); // Output: 2