You can write a helper function to perform the transformation:
function formatDate(year) {
if (year < 0) {
return `${Math.abs(year)} BCE`;
} else {
return `${year}`;
}
}
Then, you can call the helper using, for example, formatDate(-3600)
to get "3600 BCE".