As someone who is new to Javascript, I am interested in learning how to retrieve values from a function.
In the given code snippet, my goal is to extract TheName, TheHeight, TheGender, and TheSexuality when executing the function so that I can utilize them for various tasks within my program.
Sample Code:
function randomValues()
{
var Name = Object.values(person.Names);
var Height = Object.values(person.Heights);
var Gender = Object.values(person.Genders);
var Sexuality = Object.values(person.Sexualities);
var TheName = Name[Math.floor(Math.random() * Name.length)];
var TheHeight = Height[Math.floor(Math.random() * Height.length)];
var TheGender = Gender[Math.floor(Math.random() * Gender.length)];
var TheSexuality = Sexuality[Math.floor(Math.random() * Sexuality.length)];
console.log('Name: ' + TheName + ', Height: ' + TheHeight +
', Gender: ' + TheGender + ', Sexuality: ' + TheSexuality);
}
Any assistance on this matter would be highly valued. :)