Concatenate fields into one text box

Also just to add, if you go back to your linked example page from Wix.
https://support.wix.com/en/article/corvid-tutorial-calculating-and-displaying-collection-data

You will notice that the example they give you, that you have used in the top part of your code, actually needs to be placed in the data.js file in your backend and not on your page.

You can add a hook to a collection by clicking on Hooks in the Content Manager’s menu. After choosing which hooks you want to register, skeletal code will be added to a file named data.js in your site’s Backend for each hook you selected.

// In file backend/data.js

export function Employees_afterQuery(item, context) {
item.fullName = item.lastName + ", " + item.firstName;
item.age = ageFromDob(item.dob);

return item;
}

However, for yourself and ease of use and unless you are going to have a full name field saving it in your dataset too.

Then just use the code on your page like Yevheniia has shown you to combine the two fields into the one text string for your full name.