Code a study from scratch

Welcome to the lab.js tutorial, and thank you for checking out our library! We hope you like it, and are excited to see how you are going to use it in your research.

On the following pages, we’re going to provide an introduction to building experiments using lab.js, and show you how the library works. In our experience, it will take between 30 minutes and an hour to get a feel for how to work with the library, and probably an afternoon to build your first experiment. After that, our experience is that things get progressively easier, and students can often build a complete experiment in an hour or two.

The experiments will be built as web pages, so the tutorial presupposes some familiarity with HTML and CSS, and some (minimal) experience in programming (not necessarily in Javascript – R users, in our experience, quickly feel at home).

If you are not familiar with HTML and CSS, it is well worth it to spend some time learning these skills, which are handy regardless of how you will build your experiments, and useful far beyond the domain of online experiments. These topics warrant their own tutorials; thankfully, Codecademy offers an excellent course on HTML and CSS that will teach you everything you need to know for building experiments online and more. If you are just getting started with making web pages, we warmly recommend this course. Similarly, there is a very good introductory Javascript course offered on Codecademy and another on Khan Academy. However, having detailed Javascript knowledge is not necessary for following the tutorial: If you have a little experience in programming (especially with R), or if you are willing to experiment and mess with the code, please be invited to jump right in and consult further resources as required.

With that, let’s get started!


We’re actively working on the tutorials – things might be slightly ajar still. If you spot something that might be improved, please let us know.