// Step 1:
// a. create a new variable named "pillCost".
// b. set its value to be the product of pill count and pill price.
// c. get the values of pill count and pill price by calling the appropriate helper functions.
function getPillPrice() {
let pillPrice = parseFloat(document.getElementById("pill-price").value);
console.log("pill-price: " + pillPrice);
return pillPrice;
}
function getPillCount() {
let pillCount = parseFloat(document.getElementById("pill-count").value);
console.log("pill-count: " + pillCount);
return pillCount;
}
function getPillCost() {
let pillPrice = parseFloat(document.getElementById("pill-price").value);
let pillCount = parseFloat(document.getElementById("pill-count").value);
let pillCost = pillPrice * pillCount;
console.log('pillCost: ' + pillCost);
return pillCost;
}
// d. dump the value of pillCost in the console so you can see what's going on.
// To do this, uncomment the line below -- after you've done (1a) and (1b).
// console.log("pillCost: " + pillCost);
// e. open your devtools console to see the message.i
When I call the function getPillCost() in the console it said uncaught reference error:getPillCost is undefined but I don't know why it had this problem.
// a. create a new variable named "pillCost".
// b. set its value to be the product of pill count and pill price.
// c. get the values of pill count and pill price by calling the appropriate helper functions.
function getPillPrice() {
let pillPrice = parseFloat(document.getElementById("pill-price").value);
console.log("pill-price: " + pillPrice);
return pillPrice;
}
function getPillCount() {
let pillCount = parseFloat(document.getElementById("pill-count").value);
console.log("pill-count: " + pillCount);
return pillCount;
}
function getPillCost() {
let pillPrice = parseFloat(document.getElementById("pill-price").value);
let pillCount = parseFloat(document.getElementById("pill-count").value);
let pillCost = pillPrice * pillCount;
console.log('pillCost: ' + pillCost);
return pillCost;
}
// d. dump the value of pillCost in the console so you can see what's going on.
// To do this, uncomment the line below -- after you've done (1a) and (1b).
// console.log("pillCost: " + pillCost);
// e. open your devtools console to see the message.i
When I call the function getPillCost() in the console it said uncaught reference error:getPillCost is undefined but I don't know why it had this problem.