How to create todoist task using todoist api v7 and JavaScript?

Todoist allows programmers to add tasks via their API. This is great if you want to integrate your other systems or web services with Todoist. However, the Todoist documentation doesn’t provide a working example and it can become tricky to figure out the right way to do it. Therefor, I created the demo script to add a task in JavaScript via the API version 7.