50 lines
1.4 KiB
HTML
50 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Exercise: Don't Repeat Yourself (DRY)</title>
|
|
</head>
|
|
<body>
|
|
<h1>Exercise: Don't Repeat Yourself (DRY)</h1>
|
|
|
|
<script>
|
|
'use strict';
|
|
|
|
function logWeatherReports() {
|
|
// Weather Report 1
|
|
const city1 = 'New York';
|
|
const temperature1 = 85;
|
|
const humidity1 = 70;
|
|
const description1 = 'Sunny';
|
|
const windSpeed1 = 10;
|
|
console.log(
|
|
`Weather in ${city1}: ${temperature1}°F, ${humidity1}% humidity, ${description1}, Wind Speed: ${windSpeed1} mph`
|
|
);
|
|
|
|
// Weather Report 2
|
|
const city2 = 'Los Angeles';
|
|
const temperature2 = 75;
|
|
const humidity2 = 60;
|
|
const description2 = 'Partly Cloudy';
|
|
const windSpeed2 = 7;
|
|
console.log(
|
|
`Weather in ${city2}: ${temperature2}°F, ${humidity2}% humidity, ${description2}, Wind Speed: ${windSpeed2} mph`
|
|
);
|
|
|
|
// Weather Report 3
|
|
const city3 = 'Chicago';
|
|
const temperature3 = 70;
|
|
const humidity3 = 65;
|
|
const description3 = 'Rainy';
|
|
const windSpeed3 = 12;
|
|
console.log(
|
|
`Weather in ${city3}: ${temperature3}°F, ${humidity3}% humidity, ${description3}, Wind Speed: ${windSpeed3} mph`
|
|
);
|
|
}
|
|
|
|
logWeatherReports();
|
|
</script>
|
|
</body>
|
|
</html>
|