can we write automation program in javascript code example

Example: can we write multiple trigger on an object salesforce

trigger TestObjectTrigger on TestObject__c (before insert, after insert, before update, after update,...) {
	
	TestObjectTriggerHelper helper = new TestObjectTriggerHelper();

   if(trigger.isBefore) {

   		if(trigger.isInsert) {   			
   			helper.beforeInsert(trigger.new, trigger.old);
   		}
   		if(trigger.isUpdate) {
   			
   			helper.beforeUpdate(trigger.new, trigger.old);
   		}
   		....
   		..
   		.
   }
   if(trigger.isAfter) {

   		if(trigger.isInsert) {
   			
   			helper.afterInsert(trigger.new, trigger.old);
   		}
   		if(trigger.isUpdate) {
   			
   			helper.afterUpdate(trigger.new, trigger.old);
   		}
   		....
   		..
   		.
   }
}

Tags:

Misc Example