Define function getPeopleInSales()
Print the names of all the people in the sales department.
<div>
<table>
<tr>
<th>Name</th>
<th>Department</th>
</tr>
<tr>
<td class="empName">John</td>
<td>Sales</td>
</tr>
<tr>
<td class="empName">Amy</td>
<td>Finance</td>
</tr>
<tr>
<td class="empName">Austin</td>
<td>Sales</td>
</tr>
<tr>
<td class="empName">Katie</td>
<td>Marketing</td>
</tr>
<tr>
<td class="empName"
data-customAttr="court">Courtney</td>
<td>Sales</td>
</tr>
<tr>
<td class="empName">Scout</td>
<td>Sales</td>
</tr>
</table>
</div>
Complete HTML + JavaScript code for the given requirement:
<!DOCTYPE html>
<html>
<head>
<title>Read Data from HTML Table uisng
JavaScript</title>
</head>
<body>
<table id="empTable">
<tr>
<th>Name</th>
<th>Department</th>
</tr>
<tr>
<td
class="empName">John</td>
<td>Sales</td>
</tr>
<tr>
<td
class="empName">Amy</td>
<td>Finance</td>
</tr>
<tr>
<td class="empName">Austin</td>
<td>Sales</td>
</tr>
<tr>
<td class="empName">Katie</td>
<td>Marketing</td>
</tr>
<tr>
<td class="empName"
data-customAttr="court">Courtney</td>
<td>Sales</td>
</tr>
<tr>
<td class="empName">Scout</td>
<td>Sales</td>
</tr>
</table>
</div>
<p><input type="button" id="bt" value="Show
Sales Department Data" onclick="getPeopleInSales()"
/></p>
<p id="info"></p>
</body>
<script>
function getPeopleInSales() {
document.getElementById('info').innerHTML = "";
var myTab = document.getElementById('empTable');
// LOOP THROUGH EACH ROW OF THE TABLE AFTER
HEADER.
for (i = 1; i < myTab.rows.length; i++) {
// GET THE CELLS COLLECTION OF THE CURRENT ROW.
var objCells = myTab.rows.item(i).cells;
// LOOP THROUGH EACH CELL OF THE CURENT ROW TO READ CELL
VALUES.
for (var j = 0; j < objCells.length; j++) {
//get the department name
department = objCells[1].innerText;
//if department name matches Sales
if(department == 'Sales'){
info.innerHTML =
info.innerHTML +' ' +objCells.item(j).innerHTML;
}
break;
}
info.innerHTML = info.innerHTML ; // ADD A BREAK (TAG) IF NEW LINE
IS REQUIRED.
}
}
</script>
</html>
Output:

Define function getPeopleInSales() Print the names of all the people in the sales department. <div> <table>...
Only need help with question 5
2 CASE The Human Resource Function of Harrison Brothers Corporation COMPANY HISTORY Harrison Brothers Corporation n was founded in upstate New York on September 15, 1898, by Aubrey and William Harrison. Harrison Brothers is a multi-line traditional department store tha t cares mainly men's, wome expanded to include household furnishings and other items for the home. The long-term goal of the company is to become the leading chain of department stores in the Northeast,...