I want the check function to prepend "0" to hour if it is below 10.
var date = new Date();
var day = date.getDate();
var month = date.getMonth() + 1;
var year = date.getFullYear();
var hour = date.getHours();
var minutes = date.getMinutes();
function check(x) {
  if (x < 10) {
    x = '0' + x;
  }
};
check(hour);
console.log(hour);But when I check console.log(hour); it still returns the previous value. Why is this the case?
 
     
    