-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_2.js
35 lines (31 loc) · 1.21 KB
/
example_2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function cookSteak(steakWeight, desiredDoneness) {
const grillTemperatureCelsius = 204;
const seasoning = 'Salt and Pepper';
// Define the cooking process
const cookingProcess = [
{ action: 'Preheat grill', temperature: grillTemperatureCelsius },
{ action: 'Season steak', seasoning },
{ action: 'Cook steak until desired doneness', desiredDoneness },
{ action: 'Serve steak' }
];
// Execute the cooking process
for (const step of cookingProcess) {
switch (step.action) {
case 'Preheat grill':
console.log(`Preheating grill to ${step.temperature}°C`); // Display temperature in Celsius
break;
case 'Season steak':
console.log(`Seasoning the steak with ${step.seasoning}`);
break;
case 'Cook steak until desired doneness':
console.log(`Cooking steak to ${step.desiredDoneness}°C`); // Display temperature in Celsius
break;
case 'Serve steak':
console.log('Steak is ready to serve!');
break;
default:
console.log('Invalid step in the cooking process.');
}
}
}
cookSteak(16, 63); // Cook a 16 oz steak to medium-rare (63°C)