7. Export Code
Once the function is finished, we can export the function as javascript code to enable us to use it however we want.
Exporting the Function
This can be done by clicking the Export
button in the bottom right corner of the function tab. This will open a dialog where we can view and copy the code.
Running the Function
The code can be run in any javascript environment, for example in a node.js environment.
For this example, we will paste the code into a .js file and run it with node.js:
We can now change the input to any zip code we want and run the code to get the city and state for that zip code. Let's change the input to 90210
and run the code:
As expected, the output is BEVERLY HILLS, CA
. It works! 🎉