main.js
1
2
3
4
5
6
7
8
9
10
const year = prompt("What year were you born?");

const calculate_age = function(year) {
  let age = 2018 - year
  return age
}

const your_age = calculate_age(year)

console.log("You are " + your_age)
Native Browser JavaScript