From c5b63aec2a8463c3082f28a99f876296ca9d3a96 Mon Sep 17 00:00:00 2001
From: Rahul Bhandari <90493221+imrahulkb@users.noreply.github.com>
Date: Sat, 14 Oct 2023 11:53:05 +0530
Subject: [PATCH] Removing Temp Variable

Removed temp variable and implemented the swap functionality using the bitwise xor technique.
---
 Data-Structures/Array/Reverse.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Data-Structures/Array/Reverse.js b/Data-Structures/Array/Reverse.js
index 79a789c017..baddc13a93 100644
--- a/Data-Structures/Array/Reverse.js
+++ b/Data-Structures/Array/Reverse.js
@@ -8,9 +8,12 @@
 const Reverse = (arr) => {
   // limit specifies the amount of Reverse actions
   for (let i = 0, j = arr.length - 1; i < arr.length / 2; i++, j--) {
-    const temp = arr[i]
-    arr[i] = arr[j]
-    arr[j] = temp
+      if(i!=j)
+      {
+        arr[i] = arr[i]^arr[j];
+        arr[j] = arr[i]^arr[j];
+        arr[i] = arr[i]^arr[j];
+      }
   }
   return arr
 }