This can be easily done if we have the names of the fields while writing the function. Imagine a situation where we have no idea about the names of the fields while writing the function.
// Function to clear the desired fields in the form
// All the arguments to the function get collected into methodArgs variable.
// It internally creates an array to collect all the arguments.
var methodArgs = ClearFormFields.arguments;
// Iterate through the array elements.
for (var i = 0; i < varArg.length; i++)
// Get control name stored in the array element.
// Set the control value to null to make it clear.
Now call the ClearFormFields method in any CRM form or field event. We can pass as many as comma separated arguments within single quotes (‘).