Skip to content

Instantly share code, notes, and snippets.

@msteckyefantis
Last active April 2, 2018 08:29
Show Gist options
  • Save msteckyefantis/5d7a391f37f74cc31e2d118e8a8dbf5d to your computer and use it in GitHub Desktop.
Save msteckyefantis/5d7a391f37f74cc31e2d118e8a8dbf5d to your computer and use it in GitHub Desktop.
Swapping the Values of Two Variables
'use strict';
// Problem: Variables a and b are defined below. How do you swap the values of variables a and b?:
let a = 2; // a is now 2
let b = 3; // b is now 3
// Solution:
let c = a;
a = b; // a is now 3
b = c; // b is now 2
@msteckyefantis
Copy link
Author

msteckyefantis commented Apr 2, 2018

Programming challenge related to this Medium article about open-source software.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment