This Gist shows you how to create reusable function which you can access anywhere in your Postman collection.
Good practice when programming is to keep your code DRY (Don't repeat yourself). You should also apply this principle when writing Postman collections for API testing.
In this example we're going to write a common logging function which just logs to the console. In the future we might want to log somewhere else, so using a common function will allow us to redirect the logging from just one place.