//JavaScript program to swap two variables
//take input from the users
let a = prompt('Enter the first variable: ');
let b = prompt('Enter the second variable: ');
//using destructuring assignment
[a, b] = [b, a];
console.log(`The value of a after swapping: ${a}`);
console.log(`The value of b after swapping: ${b}`);
Output
Enter the first variable: 4
Enter the second variable: 2
The value of a after swapping: 2
The value of b after swapping: 4
In questa pagina del sito puoi guardare il video online JavaScript Program to Swap Two Variables della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Tech Tips 03 novembre 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 23 volte e gli è piaciuto 1 spettatori. Buona visione!