how to exit function in js code example Example 1: how to terminate a program in js process.exit(1) Example 2: exit program js process.exit(1)