The JavaScript function to perform deep copy