While I am trying to grasp the concept of if-else statements with multiple conditions, I have encountered a slight issue that is causing some trouble. The 'else if' in the external condition section is being highlighted in my Visual Studio Code editor and displaying an error message saying 'Declaration or statement expected'. Could someone please help me troubleshoot this problem? Below is the code snippet that I am working on:
function solve(input) {
let gender = (input.shift());
let age = Number(input.shift());
if (gender === 'Female') {
if (age >= 18) {
console.log('You are permitted on the website, lady.')
}
} else {
console.log('You are not permitted on the website, lady.')
}
} else if (gender === 'Male') {
if (age >= 18) {
console.log('You are permitted on the website, dude.')
} else {
console.log('You are not permitted on the website, dude.')
}
} else {
console.log('Error')
}
solve(['Female', '13'])