DEV Community

Discussion on: Are you TOO OLD to start coding? Use this tool to find out!

Collapse
 
lionelrowe profile image
lionel-rowe

Ahh, but you can never age to Number.MAX_VALUE. Once you hit Number.MAX_SAFE_INTEGER + 1, you stop aging every birthday:

const startAge = Number.MAX_SAFE_INTEGER + 1
let currentAge = startAge

const happyBirthday = () => {
    ++currentAge
}

for (let i = 0; i < 1000; ++i) {
    happyBirthday()
}

console.log(currentAge === startAge) // true
Enter fullscreen mode Exit fullscreen mode
Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard

JavaScript invented immortality πŸ’’

Thread Thread
 
savvasstephnds profile image
Savvas Stephanides

That’s just an infinite loop πŸ”

Collapse
 
savvasstephnds profile image
Savvas Stephanides

Haha πŸ˜‚