Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

delete element from array javascript with loop

// remove data
const data = [2, 3, 4, 52, 13]
const position = 2

for (let i = position; i < data.length - 1; i++) {
	data[i] = data[i + 1]
}
data.length = data.length - 1
console.log(`===> :: data`, data)
 
PREVIOUS NEXT
Tagged: #delete #element #array #javascript #loop
ADD COMMENT
Topic
Name
5+9 =