A space for AI engineers to learn, share, and geek out — covering everything from LLMs and agents to the tools and tricks that make building with AI easier.
Showing posts with label JavaScript Arrays. Show all posts
Showing posts with label JavaScript Arrays. Show all posts
Quick answer: find the index with indexOf, then remove it with
splice:
const array = [2, 5, 9];
const index = array.indexOf(5);
if (index > -1) {
array.splice(index, 1); // removes 1 element at that index
}
// array is now [2, 9]