Snippets Collections
function updateIcons(update) {
    const icons = {
      ppt: "powerpoint",
      pptx: "powerpoint",
      doc: "word",
      docx: "word",
      xls: "xcel",
      xlsx: "xcel",
      pdf: "pdf",
      default: "page",
    };

    return icons[update] ?? "page";
  }
    
     <section class="fileDownload__wrapper">
          <div class="fileDownload__icon icon__${updateIcons(fileType)}"
			aria-hidden="true"></div>
       </section>`;
    
star

Tue Oct 29 2024 22:11:40 GMT+0000 (Coordinated Universal Time)

#js #dynamic-function

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension