clear formarray in angular 6

JavaScript
clearFormArray = (formArray: FormArray) => {
  while (formArray.length !== 0) {
    formArray.removeAt(0)
  }
}

Source

Also in JavaScript: