This one was given as an exercise from a wesbos`s course. It depends on the FaceDetection API, so your browser must implement it. On Chrome, you can enable this experimental API on the flags page (chrome://flags/), setting Experimental Web Platform features to Enabled.