diff --git a/core/modules/toolbar/js/escapeAdmin.js b/core/modules/toolbar/js/escapeAdmin.js
index 2d76991e9dc52259b6dcc59d606e94633e99521c..f7956befe2330608cbb4600a637e75f588f65092 100644
--- a/core/modules/toolbar/js/escapeAdmin.js
+++ b/core/modules/toolbar/js/escapeAdmin.js
@@ -14,7 +14,7 @@
   // loaded within an existing "workflow".
   if (
     !pathInfo.currentPathIsAdmin &&
-    !/destination=/.test(windowLocation.search)
+    !windowLocation.search.includes('destination=')
   ) {
     sessionStorage.setItem('escapeAdminPath', windowLocation);
   }
diff --git a/core/modules/views/js/ajax_view.js b/core/modules/views/js/ajax_view.js
index 873ad6c7e69f5aa04a1c64d14fb35f2f100fd93f..bf3ac26fa6c9a636120c63c03f2a5e6beaba71b9 100644
--- a/core/modules/views/js/ajax_view.js
+++ b/core/modules/views/js/ajax_view.js
@@ -83,7 +83,7 @@
       if (queryString !== '') {
         // If there is a '?' in ajaxPath, clean URL are on and & should be
         // used to add parameters.
-        queryString = (/\?/.test(ajaxPath) ? '&' : '?') + queryString;
+        queryString = (ajaxPath.includes('?') ? '&' : '?') + queryString;
       }
     }