How to use a list in json file as an argument for case in javascript

  Kiến thức lập trình

so there is my chrome extension code (not fully but other part is just html and css code):

switch (window.location.hostname) {
    case "www.youtube.com":
        document.head.innerHTML = generateSTYLES();
        document.body.innerHTML = generateHTML("YouTube");
    break
}

So i want to put other website than YouTube, but i don’t to just copy this code as many time as i need to add website. I want to put all the website in a json file and then execute this code for every of them. Can anyone help with doing it in javascript and the json file ? Thanks

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT