---
title: "Discussion on \"How to Swap Variables\" | Hashnode"
description: "Discussion on \"How to Swap Variables\". In this article we will present 3 ways to swap values in two variables, using JavaScript. The first two can be applied in any programming language, the third is JavaScript specific.\nThe task: \nWe have two variables a, b holding a value each. We want ..."
url: "https://hashnode.com/posts/how-to-swap-variables/62efa6c0e3a3793580e02cee"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to Swap Variables](https://dimitrios.hashnode.dev/how-to-swap-variables?utm_source=hashnode&utm_medium=feed)

In this article we will present 3 ways to swap values in two variables, using JavaScript. The first two can be applied in any programming language, the third is JavaScript specific. The task: We have two variables a, b holding a value each. We want ...

Aug 7, 2022 · 3 min read · dimitrios.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#destructuring](https://hashnode.com/tag/destructuring)
-   [#swap-varables](https://hashnode.com/tag/swap-varables)
-   [#temporary-variable](https://hashnode.com/tag/temporary-variable)

## Written by

[Dimitris](https://hashnode.com/@Dimitrios)

@Dimitrios

  
[View profile](https://hashnode.com/@Dimitrios)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
