JS
challenger
Home
JavaScript Basics
arrays
Swap Two Elements in an Array
Swap Two Elements in an Array
You have an array of fruit. Swap the first and last elements of the array so that the array begins with 'pear' and ends with 'apple'.
Premium
reset
function greet(name) { return `Hello, ${name}!`; } console.log(greet("Erik"));
JavaScript
Run Code
Console