// Make life easier and change Date() to 'd' var d = new Date() // Set the main variables var birthyear = d.setFullYear(1991) var year= d.getFullYear() // subtract the two var age = year - birthyear // Output age document.write(age)