Hi @GPozzi!
Would you provide a little more context for this? ie. Screenshots of the code you tried? Are EmployeeCode and EmployeeLog arrays? What do you then need to happen with the information?
Here’s a quick piece of JavaScript that does what I think you’re asking, but let me know if that’s not it:
var EmployeeCode = ["ABC123", "DEF456", "GHI789"]; // These employees were expected
var EmployeeLog = ["ABC123", "GHI789"] // These employees were present
var NotPresent = [];
// Next, we will determine which employees were not present by passing each expected employee through the array of present employees.
// We will append the absent employee to the "NotPresent" array.
for (var i = 0; i < EmployeeCode.length; i++) {
if (!EmployeeLog.includes(EmployeeCode[i])) {
NotPresent.push(EmployeeCode[i]);
}
}
output = [{NotPresent}] // 👉🏻 ["DEF456"]
Hi @GPozzi!
Would you provide a little more context for this? ie. Screenshots of the code you tried? Are EmployeeCode and EmployeeLog arrays? What do you then need to happen with the information?
Here’s a quick piece of JavaScript that does what I think you’re asking, but let me know if that’s not it:
var EmployeeCode = ["ABC123", "DEF456", "GHI789"]; // These employees were expected
var EmployeeLog = ["ABC123", "GHI789"] // These employees were present
var NotPresent = [];
// Next, we will determine which employees were not present by passing each expected employee through the array of present employees.
// We will append the absent employee to the "NotPresent" array.
for (var i = 0; i < EmployeeCode.length; i++) {
if (!EmployeeLog.includes(EmployeeCode[i])) {
NotPresent.push(EmployeeCode[i]);
}
}
output = [{NotPresent}] // 👉🏻 ["DEF456"]
Wow Todd, that’s exactly what I’ve been looking for! Sorry for not being so clear, but that totally solves my question