From ec1aca7fab1f851a72c3e63a9f342bf2d07f3be8 Mon Sep 17 00:00:00 2001 From: jatking <53228426+Jatkingmodern@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:59:46 +0530 Subject: [PATCH] Update xor_swap.js Added additional type safety --- code/bit_manipulation/src/xor_swap/xor_swap.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/bit_manipulation/src/xor_swap/xor_swap.js b/code/bit_manipulation/src/xor_swap/xor_swap.js index 248225a015..09b9b08e07 100644 --- a/code/bit_manipulation/src/xor_swap/xor_swap.js +++ b/code/bit_manipulation/src/xor_swap/xor_swap.js @@ -1,6 +1,6 @@ // Part of Cosmos by OpenGenus Foundation -function xorSwap(a, b) { +function xorSwap(a: number, b: number): void { console.log(`Before swap: a = ${a}, b = ${b}`); a = a ^ b; // Step 1: a now contains the XOR of both @@ -11,6 +11,6 @@ function xorSwap(a, b) { } // Example usage: -let x = 5; -let y = 10; +let x: number = 5; +let y: number = 10; xorSwap(x, y);