add zero to single digit javascript code example

Example: Adding "0" if clock have one digit

let str = "34"

str = str.padStart(4, "0") // results in "0034"
console.log(str)

For Clock Example : 

var now = new Date(); 
var year= now.getFullYear(); 
var month= (now.getMonth()+1).toString().padStart(2, "0");
var day= now.getDate().toString().padStart(2, "0");
var hour = now.getHours().toString().padStart(2, "0");
var minute = now.getMinutes().toString().padStart(2, "0");

document.getElementById("date").innerHTML =`${day}-${month}-${year}-${hour}:${minute}`;

<div id="date"></div>