Why is the if else logic not working?

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!