Created
June 15, 2022 15:08
-
-
Save seoutopico/d98be0505bfb8fa591fd5c3f71124f72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Obtener la categoria según la URL | |
function getCategory(url) { | |
//var url = "https://www.mismascotas.es/219-golosinas-snacks-gatos"; | |
let mapa= new Map(); | |
mapa.set("Cat Perros","perros"); | |
mapa.set("Cat Gatos","gatos"); | |
for (let values of mapa.values()) { | |
var verificar = url.split("-").includes(values); | |
if(verificar === true){ | |
return(values) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment