i try to reading code of pandajs
game engine and according to this code from github :
playMusic: function(name, loop) {
var volume = this.musicMuted ? 0 : this.musicVolume;
if (typeof loop === 'undefined') loop = true;
if (this.currentMusic) this._stop(this.currentMusic);
this.currentMusic = this._play(name, !!loop, volume);
this.currentMusicName = name;
return !!this.currentMusic;
}
and it's return !!this.currentMusic
i try to figure it out but i cant understand why he use it. for example this code :
function a(arg){
console.log(!!arg);
}
a(true)
a(false)
if i pass true it's print true and if i pass false it's print false , so why not just return this.currentMusic
instead of !!this.currentMusic
or in my example just console.log(arg)
instead of console.log(!!arg)