How to swap two variables in JavaScript May 29, 2022 by IT Nursery I have this two variables: var a = 1, b = 2; My question is how to swap them? Only this variables, not any objects. 22 Answers 22