Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript append to array

arr = [1, 2, 3, 4]
arr.push(5) // adds element to end

arr.unshift(0) // adds element to beginning
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #append #array
ADD COMMENT
Topic
Name
5+4 =