Running all javascript info in HTML


#1

How can I run and display all of this info in HTML?

let orderCount = 1;
const orderCar = (color, engine, design, interior, exterior) => {
orderCount++;
console.log(
“Color =” + color + " | Engine = " + engine + " | Design = " + design + " | Interior = " + interior + " | Exterior = " + exterior
);
}

orderCar(
‘Raceyellow’,
‘V8’,
‘FrontStripes’,
‘Leather’,
‘Matte’
);
//
let priceByColor = {
Winered: 3500,
Red: 2500,
Yellow: 2000,
Raceyellow: 4000,
Black: 1000,
White: 1500,
Green: 3400,
};

const getColor = () => {
return priceByColor[‘Raceyellow’]
};
//
let priceByEngine = {
V6: 5600,
V8: 7200,
V12: 9100,
};
const getEngine = () => {
return priceByEngine[‘V8’]
};
//

let priceByDesign = {
FrontStripes: 300,
BackStripes: 200,
FullStripes: 500,
};
const getDesign = () => {
return priceByDesign[‘FrontStripes’]
};
//
let priceByInterior = {
Red: 250,
Blue: 300,
Yellow: 150,
Black: 200,
};

const getInterior = () => {
return priceByInterior[‘Red’]
};
//

let priceByExterior = {
CarbonLook: 5800,
Matte: 3000,
Metallic: 4500,
Pearlescent: 5000,
};

const getExterior = () => {
return priceByExterior[‘Matte’]
};
//

let priceByCar = {
Sports: 38000,
Super: 50000,
Muscle: 25000,
Classic: 42000,
Average: 20000,
};

const getCar = () => {
return priceByCar[‘Muscle’]
};

//
const getTotal = () => {
return getColor() + getEngine() + getDesign() + getInterior() + getExterior() + getCar();
};
console.log("");

console.log("The price of the whole car is " + getTotal() * 1.1);

//console.log(“The car will be ready by “)
var dateObj = new Date();
var day = dateObj.getUTCDate();
var month = dateObj.getUTCMonth() + 1;
var year = dateObj.getUTCFullYear();
//newdate = year + “/” + month + “/” + day + “/”;
var d = new Date();
var n = d.getFullYear();
//
console.log(””);
console.log("The current date is " + year + “/” + month + “/” + day);

//
const getEstimate = () => {
return year + “/” + month + “/” + day + “/”;
};
var someDate = new Date();
var daysToAdd = 10;

someDate.setDate(someDate.getDate() + daysToAdd);
console.log("");
console.log(“Car completion estimated to be at " + someDate);
console.log(”")
//
console.log(" #####" + " #" + " #" + " ###" + " ######" + " ####" + " #" + " #");
console.log("#" + " #" + " #" + " #" + " #" + " #" + " #" + " #" + " #" + “#” + " #");
console.log("#" + " #" + " #" + " ###" + " #" + " #" + " #" + " #" + " #" + “#” + " #");
console.log("#" + " #" + " #" + " #" + " #" + " #" + " #" + " #" + " #");
console.log("#" + " #" + " #" + " #" + " #" + " #" + " #" + " #" + " #");
console.log(" #####" + " ####" + " ####" + " #" + " ####" + " #" + " #");
console.log("");
console.log("");
console.log(" #####" + " #" + “#” + " #####");
console.log(" #" + " #" + " #" + " #" + " #");
console.log(" #" + " #" + “####” + “#” + " #" + “###”);
console.log(" #" + " #" + " #" + " #" + " #");
console.log(" #" + " #" + " #" + " #" + " #");
console.log(" #####" + " #" + " #" + " #" + " #");

I tried numerous times but nothing worked


#2

What have you tried? Show us.

you need to understand the difference between window and console. See here:

https://developer.mozilla.org/en-US/docs/Web/API/Window
https://developer.mozilla.org/en-US/docs/Web/API/Console

console is a browser tool generally used for debugging, if you open the console (which is build into your browser), you should see output.

Like i have been trying to tell you, console.log() won’t display anything the way you desire

you need to learn how to insert into the DOM. Which require Javascript function like .innerHTML.