If you don’t know any JavaScript, this is a quick 5 minute course explaining most things you will need to understand.
Docs
If you need a more in depth explanation you can look up anything on developer.mozilla.org, everything except for the dom will apply to gjs.
Semicolons
Semicolons are optional, as there is automatic semicolon insertions
Logging, printing
Variables
To define a variable use the let
or const
keyword
Flow control
if else
while loop
for loop
for of loop
Functions
There are multiple ways to define functions, with the function
keyword or with fat arrow functions, also know as lambda functions in other languages
named function
nameless function assigned to a const variable
fat arrow function a.k.a lambda
invoke all of them like any other function
default parameter value
Destructuring
arrays
objects
useful in function definitions
Modules
exporting
importing
use backticks
and ${}