8_default_if.js 339 B

123456789101112131415
  1. let surname = prompt('Фамилия');
  2. let firstName = prompt('Имя');
  3. let middleName = prompt('Отчество');
  4. if(!surname) {
  5. surname = 'Гончаренко';
  6. }
  7. if(!firstName) {
  8. firstName = 'Сергей';
  9. }
  10. if(!middleName) {
  11. middleName = 'Николаевич'
  12. }
  13. alert(`${surname} ${firstName} ${middleName}`);