Indonesia WhatsApp Formatter JavaScript

function whatsappFormatter(phone) {
  if (phone.indexOf('08') === 0) {
    phone = '62' + phone.substring(1);
  }
  return phone;
}
yusuf_fazeri