MCPcopy Create free account
hub / github.com/careercup/CtCI-6th-Edition-JavaScript / Player

Function Player

chapter07/7.03 - Jukebox/jukebox.js:1–4  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1var Player = function() {
2 this.songQueue = [];
3 this.currentSong = null;
4};
5
6Player.prototype.shuffle = function() {
7 this.songQueue.sort(() => { return Math.random() > 0.5 ? 1 : 0; });

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected