Help with provisons pls

Good evening, can you tell me what I’m doing wrong, why the code is always executed to the end, skipping the first condition

const now = Date.now();
let IPCPE = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.MACAddress", {value: 1}).value[0];
let config = ext('test2.js', 'getParam', IPCPE);
log('credits', config);

let SSID = "!TLS" + config.dogovor;
if (declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID").value === SSID) {
  log("SSID configured");
  return;
}

let bam = "EAPAuthentication"; 
let enc = "AESEncryption";
declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.BasicAuthenticationMode",{value:now},{value:bam}); 
declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAAuthenticationMode",{value:now},{value:bam}); 
declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.WPAEncryptionModes",{value:now},{value:enc}); 
declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.IEEE11iAuthenticationMode",{value:now},{value:"PSKAuthentication"}); 
declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.IEEE11iEncryptionModes",{value:now},{value:enc}); 
declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID", {value: now}, {value: SSID});
declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.11.SSID", {value: now}, {value: SSID});
declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.KeyPassphrase", {value: now}, {value: config.password});

Because you are comparing an array to a string. The value property returned by the declare function is an array consisting of the value in index 0, and type in index 1.

if (declare("InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.SSID").value[0] === SSID) {
  log("SSID configured");
  return;
}
1 Like