Create an object or a Map of text by the construction year's number. If the number doesn't exist on the object use 'Inconnue'
as a fallback:
const textByNumber = {
3: 'Avant 1944',
4: 'Entre 1945 et 1974',
5: 'Entre 1975 et 1989',
...
};
const resultsConstructionYear = readCookie('constructionYear');
document.getElementById('resultsUserConstructionYear')
.innerHTML = textByNumber[resultsConstructionYear] || 'Inconnue';
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…