How to block all JS scripts until cookies consent received

I want to set cookie consent banner for my blog.
I got sample JS code at 2GDPR and I want to put ALL my JS scripts in myScripts() function.
Could you tell, is someone using it and is this approach right?

Thank you, but Iubenda cookie consent has limits and is not free :sleepy:
I don’t want to pay for what can be found for free :slightly_smiling_face:
2GDPR cookie consent is free and has no limits

Look for a value in local storage (you are going to define it, call something it like “cookieConsent”. If it doesn’t exist set to false. Read the cookie consent off, if that is an agree, then set the local to true.

If the consent is given, load the scripts, for example:

Can anyone help me that how i can put the cookie banner on my website.