find | const setBusinessLogo = () => {
const logoMap = {
"_default": "travis-perkins.svg",
"business-benchmarkkitchensjoinery": "benchmark.svg",
"business-bss": "bss.svg",
"business-ccf": "CCF.svg",
"business-keylinecivilsspecialist": "keyline.svg",
"business-keyline": "keyline.svg",
"business-toolstation": "tool-station.svg",
"business-travisperkinsplc": "travis-perkins-new.svg",
"business-tfsolutions": "tfsolutions.svg",
"business-staircraft": "staircraft.svg",
"business-travisperkinsmanagedservices": "managed-services.svg"
};
const presentClass = Object
.keys(logoMap)
.find((k) => document.querySelector("#test").classList.contains(k));
let path = logoMap[presentClass];
if(!path) { path = logoMap._default; }
console.log(path);
};
setBusinessLogo();
| ready |
foreach | const setBusinessLogo = () => {
const logoMap = {
"_default": "travis-perkins.svg",
"business-benchmarkkitchensjoinery": "benchmark.svg",
"business-bss": "bss.svg",
"business-ccf": "CCF.svg",
"business-keylinecivilsspecialist": "keyline.svg",
"business-keyline": "keyline.svg",
"business-toolstation": "tool-station.svg",
"business-travisperkinsplc": "travis-perkins-new.svg",
"business-tfsolutions": "tfsolutions.svg",
"business-staircraft": "staircraft.svg",
"business-travisperkinsmanagedservices": "managed-services.svg"
};
let path = logoMap._default;
for (const key in logoMap) {
if(document.querySelector("#test").classList.contains(key)) {
path = logoMap[key];
break;
}
}
console.log(path);
};
setBusinessLogo();
| ready |
forof | const setBusinessLogo = () => {
const logoMap = {
"_default": "travis-perkins.svg",
"business-benchmarkkitchensjoinery": "benchmark.svg",
"business-bss": "bss.svg",
"business-ccf": "CCF.svg",
"business-keylinecivilsspecialist": "keyline.svg",
"business-keyline": "keyline.svg",
"business-toolstation": "tool-station.svg",
"business-travisperkinsplc": "travis-perkins-new.svg",
"business-tfsolutions": "tfsolutions.svg",
"business-staircraft": "staircraft.svg",
"business-travisperkinsmanagedservices": "managed-services.svg"
};
let path = logoMap._default;
for (const key of Object.keys(logoMap)) {
if (document.querySelector("#test").classList.contains(key)) {
path = logoMap[key];
break;
}
}
console.log(path);
};
setBusinessLogo();
| ready |