Just negate it.

filteredResult = filteredResult.filter(e => !e.selectedFields.includes("Red"))
Answer from tremby on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › includes
Array.prototype.includes() - JavaScript | MDN
[1, 2, 3].includes(2); // true [1, 2, 3].includes(4); // false [1, 2, 3].includes(3, 3); // false [1, 2, 3].includes(3, -1); // true [1, 2, NaN].includes(NaN); // true ["1", "2", "3"].includes(3); // false · If fromIndex is greater than or equal to the length of the array, false is returned. The array will not be searched.
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-array-not-includes
Check if Array Doesn't contain a Value in JavaScript | bobbyhadz
The falsy values in JavaScript are: null, undefined, empty string, NaN, 0 and false. If you have to perform the test often, define a reusable function. ... Copied!function notIncludes(array, value) { return !array.includes(value); } const arr = ['a', 'b', 'c']; console.log(notIncludes(arr, 'c')); // 👉️ false console.log(notIncludes(arr, 'd')); // 👉️ true console.log(notIncludes(arr, 'z')); // 👉️ true
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
Why "not includes" doesn't work? - JavaScript - The freeCodeCamp Forum
December 16, 2019 - Tell us what’s happening: I’m trying to solve this using a for loop so I can iterate through the args and solve the problem of having more than 3 args in. Using .includes on my if statement is returning the elements in the arr found in the other args, however, when I negate that, I’m getting the whole arr.
🌐
Sentry
sentry.io › sentry answers › javascript › how do i check if an array includes a value in javascript?
How do I check if an array includes a value in JavaScript? | Sentry
If the value is not pointing to the same location in memory, the includes() method will return false. In the code below, a new object is created for the val variable, which has the same properties as the first element in the person array:
🌐
sebhastian
sebhastian.com › javascript-array-not-includes
JavaScript Array Not Includes a Certain Value | sebhastian
October 26, 2023 - This is useful when you need to ... array doesn’t contain a certain value, you need to use the logical NOT ! operator and negate the call to the includes() method....
🌐
SamanthaMing
samanthaming.com › tidbits › 81-how-to-check-if-array-includes-a-value
How to check if array includes a value in JavaScript? | SamanthaMing.com
In a previous code note, I talked about a quick & dirty way to check objects using JSON.stringify(). ... const array = [{ name: 'js' }, { name: 'css' }]; array.some(code => JSON.stringify(code) === JSON.stringify({ name: 'css' })); // true ... const array = ['SAMANTHA']; array.includes('samantha'); // false array.indexOf('samantha') !== -1; // false
🌐
ServiceNow Community
servicenow.com › community › developer-forum › array-includes-always-return-false › m-p › 2106983
Solved: array.includes() always return false - ServiceNow Community
February 7, 2024 - Log the type of the userID variable you push into the array to make sure it's a string. gs.info("Typeof userID: " + typeof userID); checkedManagers.push(userID); ... I'm not finding support for the includes() function for arrays in my PDI.
Find elsewhere
🌐
PTC
ptc.com › en › support › article › CS331596
JavaScript Array includes() function not working as ...
JavaScript Array method Array.prototype.includes() not returning expected results ·
🌐
Built In
builtin.com › software-engineering-perspectives › javascript-array-contains
JavaScript Array Contains: 6 Methods to Find a Value | Built In
Summary: JavaScript offers multiple methods to check if an array contains a value, including indexOf, includes, some, find and findIndex. While indexOf fails with NaN, includes detects it. Object searches use callback functions with some, find and findIndex. more JavaScript offers multiple methods to check if an array contains a value, including indexOf, includes, some, find and findIndex.
🌐
Reddit
reddit.com › r/webdev › javascript .includes not working / issues
r/webdev on Reddit: Javascript .includes not working / issues
August 2, 2018 -

Hi All,

Trying to get a little function going where when a client leaves a * or symbol in a certain table cell, the background color of that table cell will change.

This is all in a `if is_page())` and I'm also using ACF.

I receive this error in Chrome Console:

Uncaught TypeError: cells.includes is not a function

Any assistance would be great!

UPDATE: SOLUTION IS BELOW

Solution:

<script type="text/javascript">
function cellColorBlue() {
var tableCells = [...document.querySelectorAll("td")];
for (cell of tableCells) {
	if(cell.innerText.includes("*")) {
	cell.style.backgroundColor = "#63b2df";
	} 
} 
}

function cellColorGreen() {
var tableCells = [...document.querySelectorAll("td")];
for (cell of tableCells) {
	if(cell.innerText.includes("^")) {
	cell.style.backgroundColor = "#9ce158";
	} 
} 
}

cellColorBlue();
cellColorGreen();
</script>
🌐
Mastering JS
masteringjs.io › tutorials › fundamentals › includes
Check if a JS Array Contains a Specific Value - Mastering JS
To check whether arr contains v, you would use arr.indexOf(v) !== -1. In some codebases, you may see ~arr.indexOf(v) instead, where ~ is the JavaScript bitwise NOT operator. Given an integer v, ~v === -(v + 1), so ~v === 0 only if v === -1. This is a handy trick to avoid having to write out !== -1. However, using bitwise NOT is generally bad practice because it sacrifices readability to save 4 characters. const arr = ['A', 'B', 'C']; if (~arr.indexOf('A')) { // Runs } if (~arr.indexOf('D')) { // Does not run } Unlike Array#includes(), Array#indexOf() uses the same semantics as the === operator to check for equality.
🌐
GitHub
github.com › bobbyhadz › javascript-array-not-includes
GitHub - bobbyhadz/javascript-array-not-includes: A repository for an article at https://bobbyhadz.com/blog/javascript-array-not-includes
The npm run dev command uses nodemon to watch for changes and restarts your JavaScript project every time you save (Ctrl + S).
Author   bobbyhadz
🌐
Stack Abuse
stackabuse.com › javascript-check-if-array-contains-a-value-element
JavaScript: Check if Array Contains a Value/Element
March 8, 2023 - let animals = ["🐘", "🐒", ... which looks for elem in the specified array and returns the index of its first occurrence, and -1 if the array does not contain elem....
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › includes
String.prototype.includes() - JavaScript | MDN
A string to be searched for within str. Cannot be a regex. All values that are not regexes are coerced to strings, so omitting it or passing undefined causes includes() to search for the string "undefined", which is rarely what you want.
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
Includes vs. In - JavaScript - The freeCodeCamp Forum
August 18, 2022 - Today I ran into some trouble with a line of code that seems to be misleading. I tried to use if (!(arr[n][i] in arr[0])){ but I found I had to rewrite the code as if (!(result.includes(arr[n][i]))){ I am having dif…
🌐
W3Schools
w3schools.com › jsref › jsref_includes_array.asp
JavaScript Array includes() Method
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING INTRO TO HTML & CSS BASH RUST ... Array[ ] Array( ) at() concat() constructor copyWithin() entries() every() fill() filter() find() findIndex() findLast() findLastIndex() flat() flatMap() forEach() from() includes() indexOf() isArray() join() keys() lastIndexOf() length map() of() pop() prototype push() reduce() reduceRight() rest (...) reverse() shift() slice() some() sort() splice() spread (...) toReversed() toSorted() toSpliced() toString() unshift() values() valueOf() with() JS Boolean