Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

push method in javascript

*The push() method adds elements to the end of an array, and unshift() adds
elements to the beginning.*/
let twentyThree = 'XXIII';
let romanNumerals = ['XXI', 'XXII'];

romanNumerals.push(twentyThree);
// now equals ['XIX', 'XX', 'XXI', 'XXII', 'XXIII']

romanNumerals.unshift('XIX', 'XX');
// now equals ['XIX', 'XX', 'XXI', 'XXII']
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #push #method #javascript
ADD COMMENT
Topic
Name
3+3 =