Last active
April 2, 2018 08:29
-
-
Save msteckyefantis/5d7a391f37f74cc31e2d118e8a8dbf5d to your computer and use it in GitHub Desktop.
Swapping the Values of Two Variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Programming challenge related to this Medium article about open-source software.