I am new in Javascript. I have a JS method. I got so many lists of wifi network. But almost time SSID and SecurityMode is coming as same. I want to filter if both are same. Like suppose SSID is "sampleWifi" & SecurityMode is "PSK" and same SSID and SecurityMode are coming again. How to avoid that to add a list array.
My code is like below :
device.networkList = [];
for (var i = 1; i <= jqXHR.responseJSON.length; i++) {
site = jqXHR.responseJSON[i - 1];
device.networkList.push({
name: site["AvailableNetworks." + i + ".SSID"],
signal: site["AvailableNetworks." + i + ".SignalStrength"],
security: site["AvailableNetworks." + i + ".SecurityMode"]
});
}
Output is : A PSK, B PSK, C PSK, D PSK, A PSK, B PSK, R PSK, S PSK
Expected Output : A PSK, B PSK, C PSK, D PSK, R PSK, S PSK
Note : Here same A PSK, B PSK is repeated in array. But i don't want to add same duplicate value in array.
How to put a condition is SecurityMode will come it shouldn't be add device.networkList array.
Please help me.
Thanks