January 2020
Intermediate to advanced
532 pages
13h 31m
English
To improve performance, let's create a global constant by using the const keyword. Then, we can define a new function that accesses the constant, as follows:
const constant = 10function add_using_global_constant(x) return constant + xend
Let's benchmark its performance now:

This is perfect! If we introspect the function again, we get the following clean code:

Next, we will discuss how to use a global variable (not a constant) and still make it slightly better.
Read now
Unlock full access