I have a test that provides 4 values:
fPortTotal = a number with how many ports in a firewall test.
fProtocol = an array with what protocol the port is (ex. UDP, TCP)
fPorts = an array with what port number
fStatus = an array with open or closed depending on the port
in all the arrays [0] is the first port, [1] is the 2nd, and so on.
I want to use the .map method to display each port's information in a <p>. The issue is I'm having a large amount of difficulty understanding the .map method and how to use it. I beleave the "skeleton" of the function should look like this:
function populateFw(fPorts, fStatus, fPortTotal, fProtocol) {
var output = document.getElementById('firewallRes');
var text = document.createElement ('p');
text.id = 'firewallEndResults';
text.innerHTML = arrayOfArrays.map;
}
any help would be appreciated.
arrayOfArrays.mapis useless at this point[{ fPort: 80, fProtocol: "TCP", fStatus: "Open" }, ...]?.mapcallback function gets an index as the second argument, so you could do something likefPorts.map((fport, index) => doSomething(fport, fStatus[index], fPortTotal[index], fProtocol[index])- what you do in doSomething is up to you