這段要貼在哪裡:先在自己的工作資料夾建立同名相對位置,再複製內容。
const status = document.querySelector("#status");
const action = document.querySelector("#action");
const businessName = "安心維護";
const servicePrice = 1200;
console.log(businessName, typeof businessName);
console.log(servicePrice, typeof servicePrice);
function formatService(name, price) {
// CHECKPOINT-1:請在這個函式內加入 return。
}
console.log("formatService 結果:", formatService(businessName, servicePrice));
function showResult() {
const message = formatService(businessName, servicePrice);
status.textContent = `可聯絡服務:${message}`;
console.log("畫面結果:", message);
}
if (action) action.addEventListener("click", showResult);