Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

JavaScript Question of the Day March 26, 2025

  1. Incorrect Correct No Answer was selected Invalid Answer

    Consider the following code:

    let x = 1;
    let y = 2;
    
    function main() {
        // call swap function here
    
        console.log("value of x: " + x);
        console.log("value of y: " + y);
    }
    
    main();
    JavaScript

    Which of the following swap functions can we call so that the values of x and y are successfully swapped?