In this two part challenge, I cover the Breadth-First Search algorithm is and implement it in JavaScript. My demo application is “6 Degrees of Kevin Bacon” (finding the closest relationship between Kevin Bacon and another actor). This challenge is part of the spring 2017 ITP “Intelligence and Learning” course (

Part 2:

Support this channel on Patreon:
To buy Coding Train merchandise:

Send me your questions and coding challenges!:

The Coding Train website:

Links discussed in this video:
The Nature of Code Part 2 (Spring 2017) – Intelligence and Learning:
Nature of Code:
My Video on Prototypes:
My Video on Associative Arrays:
The Oracle of Bacon:
Breadth-First Search on Wikipedia:

Books and Papers:
Grokking Algorithms book:

Source Code for the all Video Lessons:


For More Coding Challenges:
For an Intro to Programming using p5.js:

Help us caption & translate this video!