I know this can be accomplished in different ways, and there are already some example implementations suggested in other answers.
So what I'm asking is what is the most efficient in terms of computing way to do it.
Self explanatory:
var num = 3;
console.log(num.toString(2));
//Outputs: "11"
//Desired output: "00000011";
Thank you.