Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save IacovColisnicenco/cb0cd5a8394269e2c846f4caf0f2cf67 to your computer and use it in GitHub Desktop.
Save IacovColisnicenco/cb0cd5a8394269e2c846f4caf0f2cf67 to your computer and use it in GitHub Desktop.
Evolution of function calcAge(), I was inspired by Python style...
'use strict';
function calcAge(birthYear) {
const date = new Date().getFullYear();
const res = date - birthYear;
if (date !== birthYear) {
return res;
} else {
return console.log(`Год рождения не должен быть равен текушему ${date} году!`);
}
}
const firstName = 'Jonas';
console.log(calcAge(2022));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment