I'm trying to get this function to work properly in javascript, well it is working properly what i can get to happen is the bottom console.log (work(" gallons of water has been extracted from the carpet.")); I can't get the " gallons of water has been extracted from the carpet." to show up in that same line of code.
// Global variable
var waterGallons = 40
var work = function(total) {
var water = 0;
while (water < waterGallons) {
console.log("The carpet company was called out to extract " + water + " gallons of water.")
water+=4;
};
return waterGallons;
}
console.log (work(" gallons of water has been extracted from the carpet."));
So using the answers that i got for help with is what i came out with because i need to use a global variable. so my story will change by changing the global variable.
var total = 40
var work = function(total) {
var water = 0;
while (water < total) {
console.log("The carpet company was called out to extract " + water + " gallons of water.")
water+=4;
};
return water;
}
console.log (work(total) + " gallons of water has been extracted from the carpet.");
Id like to thank you guys again. I still have a boolean function, a array using a for loop function, and a procedure left. So using this i should be able to understand how to create the next parts of my assignment.
totalwas not even used.