Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Add to array, push

// Add to array

//HTML
//<button onclick="Push()">push</button>

var numbers = [1, 2, 3, 4, 5]
console.log(numbers)

function Push() {
    numbers.push('push')
    console.log(numbers)
}

// Result
// (5)[1, 2, 3, 4, 5]
// (6)[1, 2, 3, 4, 5, 'push']
 
PREVIOUS NEXT
Tagged: #Add #push
ADD COMMENT
Topic
Name
6+7 =