How do I swap the values of my function?
AndresHaro1 (0)

function roadRage() {
let rightLane = "Chevy";
let leftLane = "Honda";

//Write your code here to make the cars switch lanes
let Chevy = leftLane;
let Honda = rightLane;
return (`That ${rightLane} and ${leftLane} won't pick a lane`)

}

roadRage();

You are viewing a single comment. View All
Answered by SolarBoom (71) [earned 5 cycles]
View Answer
Vandesm14 (497)

In the repl: https://repl.it/@Vandesm14/Swap-Variables-Values
I have created a function swapLanes() which takes the right and left lanes and returns them as an array. This array is then used to reverse the order of the cars by using the index of the leftLane and storing it to the rightLane and same for the other.

Please mark this as answered if I helped your problem 👍