Le tableau javascript contient
var colors = ["red", "blue", "green"];
var hasRed = colors.includes("red"); //true
var hasYellow = colors.includes("yellow"); //false
Grepper
var colors = ["red", "blue", "green"];
var hasRed = colors.includes("red"); //true
var hasYellow = colors.includes("yellow"); //false
if(["code","padding",".com"].includes("code")){
// statement if true
}else{
// statement if flase
}
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var n = fruits.includes("Mango");
let storyWords = ['extremely', 'literally', 'actually', 'hi', 'bye', 'okay']
let unnecessaryWords = ['extremely', 'literally', 'actually' ];
let betterWords = storyWords.filter(function(word) {
return !unnecessaryWords.includes(word);
});
console.log(betterWords) // ['hi' 'bye' 'okay]
var boolValue = array.includes(item);
const url = 'https://google.com/auth'
const isAuth = url.includes('auth') //true