Zero tail

Report a typo

Create a function that replaces the last two elements of a given array with 0.

Dont print the array just return it.

Sample Input 1:

[ 'may', 'june', 'july', 'august' ]

Sample Output 1:

[ 'may', 'june', 0 ]
Write a program in JavaScript
function removeTail(array) {

}
___

Create a free account to access the full topic