Сколько стоит ваш фронтенд?

function getPrice(hours, urgency) {
  let rate = 1500; // Ставка в час
  let cost = ""; // Итоговая стоимость проекта

  // Проверяем срочность проекта
  if (urgency) {
    hours /= 2; // Уменьшаем количество часов в два раза
    rate *= 2.5; // Повышаем ставку в 2.5 раза
  }

  // Проверяем, если время проекта больше 150 часов
  if (hours > 150) {
    rate -= 250; // Уменьшаем ставку на 250 рублей
  }

  // Вычисляем итоговую стоимость проекта
  cost = hours * rate;

  return cost;
}

const projectHours = 200; // Время (в часах), которое нужно потратить на проект
const projectUrgency = true; // Булево значение, которое указывает на срочность проекта
const projectCost = getPrice(projectHours, projectUrgency);

console.log('Стоимость проекта: ' + projectCost + ' рублей');

let getPrice = function (time, boolean) {
let bet = 1500;
let price = time * bet;

if (boolean && time / 2 > 150) {
return price = (time / 2) * ((bet * 2.5) - 250);
} 
else if (boolean && time / 2 <= 150) {
 return price = (time /2) * (bet * 2.5);
} 
else if (time / 2 > 150) {
  return price = time * (bet - 250); 
} 
else if (time / 2 <= 150) {
  return price = time * bet; 
}

};

console.log(getPrice);

let getPrice = function (time, isImportant) {
  let rate = 1500;
  if (isImportant) {
    rate *= 2.5;
    time /= 2;
  }
  if (time > 150) {
    rate -= 250;
  }
  return time * rate
};

В общем я сама удивилась, но я написала такой классный и короткий код к этому заданию, что решила поделиться с вами:

let getPrice = function(time, speed) {
  let priceForHour = 1500;
  if (speed == true) {
   time /= 2;
   priceForHour *= 2.5;
}
if (time > 150) {
  priceForHour -= 250;
}
return priceForHour * time;
};

isUrgent что значит??

let getPrice = function(time, isUrgent) {
let fixPrice = 1500;

if(isUrgent) {
time /= 2;
fixPrice *= 2.5;
}

if(time > 150) {
fixPrice -= 250;
}

return fixPrice * time;

}