Can someone explain to me how this piece of code works. Also, the output is not what I want. It saves 2 files instead of 1. Javascript
func