Skip to content

Instantly share code, notes, and snippets.

@midokhorshed
Forked from levinside/doJob.js
Last active November 3, 2025 02:19
Show Gist options
  • Select an option

  • Save midokhorshed/ada5c733b6150a8f20504cb067777621 to your computer and use it in GitHub Desktop.

Select an option

Save midokhorshed/ada5c733b6150a8f20504cb067777621 to your computer and use it in GitHub Desktop.
doJob
const searchParams = new URLSearchParams(window.location.search);
const doJob = (job, urlParam) => {
// if (urlParam === undefined || searchParams.has(urlParam)) {
if (urlParam !== undefined && searchParams.has(urlParam)) {
job();
}
};
const fn = function(){
console.log('Выполнить только если в URL есть нужный параметр');
}
doJob(fn, 'dev');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment