Just curious which one will have more complexity or less performance in Javascript.
if (
pathname.startsWith('/join') ||
pathname.startsWith('/auth') ||
pathname.startsWith('/settings') ||
pathname.startsWith('/program') ||
pathname.startsWith('/planner') ||
pathname.startsWith('/shoppinglist') ||
pathname.startsWith('/workout') ||
pathname.startsWith('/recipe') ||
pathname.startsWith('/snack') ||
pathname.startsWith('/meditation') ||
pathname.startsWith('/feature') ||
pathname.startsWith('/blog') ||
pathname.startsWith('/help')
) {
Or
const regexClientPaths = /^\/(join|auth|settings|program|planner|shoppinglist|workout|recipe|snack|meditation|feature|blog|help|article)/;
if (regexClientPaths.test(pathname)) {
Just discuss which one is preferred and why?
Aucun commentaire:
Enregistrer un commentaire