If Statement Not Behaving As Expected R Learnjavascript

If Statement Not Behaving As Expected R Learnjavascript