1.Loop Invariants

free

⏱️ 2:45

2.Longest Consecutive Character

free

⏱️ 3:47

3.FizzBuzz ... Moore

free

⏱️ 4:24

4.Bracket Matching

free

⏱️ 2:55

5.Swap Two Variables In-Place

free

⏱️ 2:09

6.Array Sorting in JavaScript

⏱️ 3:45

7.Create a Linked List

free

⏱️ 4:40

8.Classic Linked List

⏱️ 2:05

9.Doubly Linked List

⏱️ 4:54

10.Revese a Linked List In-Place

⏱️ 3:45

11.Random Integers

⏱️ 3:30

12.Perfect Shuffle an Array

⏱️ 4:58

13.Derangement

⏱️ 3:48

14.Tree Data Structure Math Simplified

⏱️ 8:01

15.Queue Data Structure

⏱️ 7:23

16.Find the Repeated Item

⏱️ 3:32

17.Remove all Duplicates

⏱️ 3:25

18.Two Sum

⏱️ 3:37

19.Two Sum Sorted

⏱️ 3:36

20.Three Sum

⏱️ 7:23

Enjoy free content straight from your inbox 💌

00:00

Can you take two JavaScript variables, alpha and beta, and swap the values around so that the value stored in beta is now stored in alpha and vice versa without using a third variable. We'll answer that in this lesson. So let's go here. We have two JavaScript variables, alpha containing the string, John and Beta containing the string. Jane, our key constraint is that we will not use any new variables, and our final test will be that alpha must contain the value of beta, which was Jane and Beta must contain the value of Alpha, which was drawn. Now, most people will quite easily arrive at a temporary

00:35

variable solution where the user temporary variable to store the value of Alpha so that they can then put in the value of beta into Alpha, and then finally recover the value of Alpha from the temporary variable to store into beta, essentially swapping alpha and beta. However, this violates are constraint of not treating any temporary variables. Fortunately, we do have a solution to this problem thanks to JavaScript Destructuring. Here's a quick recap. We can create two variables, one and two by destructuring them from an existing array containing the strings, John and Jane.

01:08

So now one will be John and two will be Jane. And in addition to Destructuring, while creating variables, we can even destructure into existing variables. For example, we can have the variables one and two declared beforehand and then use these two variables to store the values provided by the array first and second members. Now, since we are creating arrays out strings over here, we can actually create an array out of existing variables as well. So we might as well just use the variables alpha and beta that we already have that are storing these two same strings. And now for the final crescendo, instead

01:43

of storing these values into these two local variables that we just created, we can use the existing variables beta and alpha in that order to essentially swap the values of alpha and beta using JavaScript destructuring. So this is not something that was possible with older versions of JavaScript, for example, ES five and Below, which did not have a already structuring. So as JavaScript continues to evolve, more interesting patterns like this continue to emerge.

1.Loop Invariants

free

⏱️ 2:45

2.Longest Consecutive Character

free

⏱️ 3:47

3.FizzBuzz ... Moore

free

⏱️ 4:24

4.Bracket Matching

free

⏱️ 2:55

5.Swap Two Variables In-Place

free

⏱️ 2:09

6.Array Sorting in JavaScript

⏱️ 3:45

7.Create a Linked List

free

⏱️ 4:40

8.Classic Linked List

⏱️ 2:05

9.Doubly Linked List

⏱️ 4:54

10.Revese a Linked List In-Place

⏱️ 3:45

11.Random Integers

⏱️ 3:30

12.Perfect Shuffle an Array

⏱️ 4:58

13.Derangement

⏱️ 3:48

14.Tree Data Structure Math Simplified

⏱️ 8:01

15.Queue Data Structure

⏱️ 7:23

16.Find the Repeated Item

⏱️ 3:32

17.Remove all Duplicates

⏱️ 3:25

18.Two Sum

⏱️ 3:37

19.Two Sum Sorted

⏱️ 3:36

20.Three Sum

⏱️ 7:23