Local Files


    • Javascript

      Weblab uses a Javascript interpreter to execute the code inside of code cells. Javascript is a lightweight, general-purpose programming language that is predominantly used as the programming language for the web. The language has matured from a basic scripting language to multi-paradigm language with modules and classes. To find out more about Javascript, check out the Mozilla Developer Network. Through Javascripts just-in-time compilation it has reached high performance and is used in more and more applications.


    • ECMAScript

      Javascript has been standardized in form of the ECMAScript specification, which is supported in all major browsers. However, Javascript is also used in non-browser environments like Node.js. Weblab conforms to the ECMAScript standard but does not support the Node.js syntax.


    • Imports

      Weblab lets you import modules from outside of Weblab. There are two kind of modules: ECMAScript modules and Node modules. Weblab only supports importing ECMAScript modules. You can import modules by their url on jsdelivr.com or skypack.dev.



    • If you just enter the package name Weblab will try to fetch the module from skypack.dev.


    • Async/Await

      Javascript supports the async/await syntax to simplify asynchronous programming. The async keyword defines asynchronous functions that return a Promise. These Promises can than be awaited to yield the result. Here is an example:



    • Asynchronous functions don't block the current thread when they are executed. This can be very handy when performing tasks that take a long time but don't need any CPU resources, for example network requests or file access.

      There are important Javascript functions that are asynchronous. One example is the fetch() function. The Fetch API provides an interface to fetch resources from the internet. It returns a Promise with the resulting HTML Response. Let's look at an example: