How to share common js functions between different http request or collection

i use postman to test web api, there are many requests or collection, in each one, i need to write js script functions in pre-request script, some functions are same or common, how to make these common functions shared between different api or collection?
thanks a lot

Hi @wayne.wu,

Welcome to the Postman community! Instead of adding the js functions on each request, you can add it at the collection-level, so that those functions are available to all the requests across the collection by clicking on the Ellipsis(…) as shown below and clicking on Edit

This will take you to the following screen where I have navigated to the Pre-Request script tab, you can go ahead and start adding the functions which are common to all requests within the collection over here:

@ aamir.ahmed
thank you, aamir ahmed for kindly explanation, i found it, it is good!

thank you, by the way
does it also means if i want to share js function beween requests in collection in tests code(not pre-test code), i need to add function in collection’s test code, but i have checked the calling sequence was collection pre-test code > request pre-test code > request test code -> collection test code, does it like this kind of behaviour?