Can someone tell me what Ive dont wrong getting errors

import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;
$w.onReady( function () {
$w(‘#createProfileButton’).onClick(() => {
let emails = ;
let labels = ;

    emails.push($w('#emailAddress').value); 

// register as member using form data
wixUsers.register($w(‘#emailAddress’).value, $w(‘#password’).value, {
“contactInfo”: {
“firstName”: $w(‘#firstName’).value,
“lastName”: $w(‘#lastName’).value,
“userName”: $w(‘#userName’).value,
“emailAddress”: $w(‘#emailAddress’).value,
“phoneNumber”: $w(‘#phoneNumber’).value,
“streetAddress”: $w(‘#streetAddress’).value,
“password”: $w(‘#password’).value,
“City”: $w(‘#City’).value,
“State”: $w(‘#State’).value,
“postalCode”: $w(‘#postalCode’).value,
“referred”: $w(‘#referred’).value,
“referredBy”: $w(‘#referredBy’).value,
“Level”: $w(‘#Level’).value,
“Rules”: $w(‘#Rules’).value,
“emails”: emails,
“labels”: labels,
}
});
$w(“#createProfileButton”).onClick(() => {
let fname = $w(“#firstName”).value;
let lname = $w(“#lastName”).value;
let phone = $w(“#phoneNumber”).value;
let refCode = fname.slice(0, 2).toLocaleLowerCase() + phone.slice(phone.length - 4, phone.length) + lname.slice(0, 2).toLocaleLowerCase();

let toInsert = {

“firstName”: fname,

“lastName”: lname,

“emailAddress”: $w(“#emailAddress”).value,

“phone”: phone,

“username”: $w(“#userName”).value,

“referredBy”: $w(“#referredBy”).value,

//“referralCode”: refCode

                    }; 

if (($w(‘#work4us’).checked === true )) {
$w(“#work4us”).value = work4Us

                            wixData.query("profile") //change this to the name of your database 

                                    .eq("work4us", work4Us) //"email is the name of the field in your database, change as necessary" 

                                    .descending("_createdDate") 

                                    .find() 

                                    .then((results) => { 
                                            console.log(results); 

if (results.items.length > 0) {

let items = results.items;

let firstItem = items[0];

let refCode = firstItem._id

                                                    console.log(refCode); 

//then just display the refCode on the page something like:

//$w(“#text1”).text = refCode

                                            }  **else**  { 
                                                    console.log("no matches found in database") 
                                            } 
                                    }) 

                    } 

            }) 

            . **catch** ((err) => { 

//check error codes and see if taken or not.

let errorMsg = err;

// $w(“#error”).show();
})
}
})
})
})
}
})

Firstly I would advise you to look through Wix existing API reference as it will give you a good starting point for the different functions of your code like register() and insert().
https://www.wix.com/corvid/reference

Then look at the register() function itself as it will show you how to write it so that your register works.
https://www.wix.com/corvid/reference/wix-users.html#register

As for starters, you don’t need the email and password in your contact info variables as that is stored in the Wix CRM through the register call, however you can use the emails variable in the contact info.
https://www.wix.com/corvid/reference/wix-crm.html#ContactInfo
This is due to the email used in the register function is for the email used to register with the website, whereas the emails in the contact info variable is for the contacts email addresses that they add.

Also, the insert() function that you use, make sure that you add it correctly so that the code knows where to store any user input data, like in which dataset for example.
https://www.wix.com/corvid/reference/wix-data.html#insert

Plus, there shouldn’t be a need to call the same click event handler on the same button twice in this code, so you shouldn’t need this line running twice.
$w(’ #createProfileButton ').onClick(() => {

Here is the code that I use for my own custom signup lightbox.

import wixUsers from 'wix-users';
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

$w.onReady(function () {
    
    $w("#registerButton").onClick( (event) => {
        
   let email = $w("#email").value;
   let password = $w("#password").value;
   let first = $w("#firstName").value;
   let last = $w("#lastName").value;

   wixUsers.register(email, password, {
       contactInfo: {
        "firstName": $w('#firstName').value,
        "lastName": $w('#lastName').value,
       }
      } )
      .then( (result) => {
        let resultStatus = result.status;
  wixWindow.lightbox.close();
  wixLocation.to("/sign-in-status"); //Change the URL ending to whatever page you want to send the user to after they log in.
      } );     
    } );
    
});

This works perfectly for myself and closes after registering details before moving the user onto my signup status page, then both names will be saved in contacts and once site member is approved the member details will be added to ‘members’ database.

Finally, if you are wanting to create your own members profile area etc with the create profile button call, then you are best looking at the Wix tutorial that is already put up for making your own members area,
as shown here.
Velo Tutorial: Building Your Own Members Area | Help Center | Wix.com
CMS: Creating Custom Member Profile Pages | Help Center | Wix.com

Ok Can you tell me what I’ve done wrong on this one its throwing me off?

Code:

import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;

$w.onReady( function () {
$w(‘#createProfileButton’).onClick(() => {
if (($w(‘#work4us’).checked === true )) {
let refCode = fname.slice(0, 2).toLocaleLowerCase() + phone.slice(phone.length - 4, phone.length) + lname.slice(0, 2).toLocaleLowerCase();
}
let fname = $w(“#firstName”).value;
let lname = $w(“#lastName”).value;
let phone = $w(“#phoneNumber”).value;
let emails = [];
let labels = [];
let toInsert = {

“firstName”: fname,

“lastName”: lname,

“emailAddress”: $w(“#emailAddress”).value,

“phone”: phone,

“username”: $w(“#userName”).value,

“referredBy”: $w(“#referredBy”).value,

“referralCode”: refCode

        }; 

emails.push($w('#emailAddress').value); 

// register as member using form data
wixUsers.register($w(‘#emailAddress’).value, $w(‘#password’).value, {
“contactInfo”: {
“firstName”: $w(‘#firstName’).value,
“lastName”: $w(‘#lastName’).value,
“userName”: $w(‘#userName’).value,
“emailAddress”: $w(‘#emailAddress’).value,
“phoneNumber”: $w(‘#phoneNumber’).value,
“streetAddress”: $w(‘#streetAddress’).value,
“password”: $w(‘#password’).value,
“City”: $w(‘#City’).value,
“State”: $w(‘#State’).value,
“postalCode”: $w(‘#postalCode’).value,
“referred”: $w(‘#referred’).value,
“referredBy”: $w(‘#referredBy’).value,
“Level”: $w(‘#Level’).value,
“Rules”: $w(‘#Rules’).value,
“emails”: emails,
“labels”: labels,
}
});
wixData.query(“profile”) //change this to the name of your database

                .eq("work4us", work4Us) //"email is the name of the field in your database, change as necessary" 

                .descending("_createdDate") 

                .find() 

                .then((results) => { 
                    console.log(results); 

if (results.items.length > 0) {

let items = results.items;

let firstItem = items[0];

let refCode = firstItem._id

                        console.log(refCode); 

//then just display the refCode on the page something like:

//$w(“#text1”).text = refCode

                    }  **else**  { 
                        console.log("no matches found in database") 
                    } 
                }) 
        } 

})
})
})
}
})