So your code should be something like this, however you would need to just check for matching pairs of curly brackets and parentheses as I’ve just stuck it together quickly to show you.
import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;
$w.onReady(function () {
$w(‘#submit’).onClick( () => {
let emails = [];
let labels = [];
emails.push($w('#email').value);
const age = $w('#age').value;
// calculate the proper age label
if (age < 18) {
labels.push("Below 18");
} else if (age < 25) {
labels.push("18 - 24");
} else if (age < 36) {
labels.push("25 - 35");
} else {
labels.push("Above 35");
}
// register as member using form data
wixUsers.register($w('#email').value, $w('#password').value, {
"contactInfo": {
"firstName": $w('#firstName').value,
"lastName": $w('#lastName').value,
"emails": emails,
"labels": labels,
"age": Number($w('#age').value)
}
} )
.then( (result) => {
let resultStatus = result.status;
wixWindow.lightbox.close();
wixLocation.to(“/home-1”); //Change the URL ending to whatever page you want to send the user to after they log in.
} );
} );
});