filteredArray is an array of variables So, I want to get a variable from it by searching in to it using a string and I want directly to use this variable in another code, can you help me?
const filteredArray = [livingRrooms, kitchens, ceilingsDesigns, bedroomsArray ];
// z is the string I get from a code that i have
const z = "livingRrooms kitchens ceilingsDesigns bedroomsArray";
function checkvar(cas) {
return z.includes(cas);
}
// as you can see next line is working just find
console.log(checkvar("kitchens"));
// this dosn't work because find use a srtict mode I need a way around it or anonther way
console.log(filteredArray.find(checkvar));