Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

store all years in array angular

// auther is Renat Galyamov thanks Renvat
function generateArrayOfYears() {
  var max = new Date().getFullYear()
  var min = max - 9
  var years = []

  for (var i = max; i >= min; i--) {
    years.push(i)
  }
  return years
}

var years = generateArrayOfYears().toString();

document.getElementById('years').innerHTML = years;
Source by renatello.com #
 
PREVIOUS NEXT
Tagged: #store #years #array #angular
ADD COMMENT
Topic
Name
6+2 =