nick34992
3/12/2017 - 9:04 AM

HTML, JavaScript: Name, Age, Job Title

HTML, JavaScript: Name, Age, Job Title

// inputs: name, age, job title; returns person's description
function name_age_job(n, a, t) {
    var person = { name: n, age: a, job: t };
    return `My name is: ${person.name}. My age is: ${person.age}.
           My job title is: ${person.job}`;
}

var name_age_job_header = document.querySelector('h3');
name_age_job_header.textContent = name_age_job('Mabel', 28, 'Receptionist');
<!DOCTYPE html>
<html lang="en-US"><meta charset=utf-8>
    <head>
        <title>Name | Age | Job</title>
    </head>
    <body>
        <h1>My Name, Age and Job Title</h1>
        <h3></h3>
        <script src="script.js"></script>
    </body>
</html>