Algorithm of frying => fried chicken


Download 1.64 Kb.
Sana08.01.2022
Hajmi1.64 Kb.
#244230
Bog'liq
Документ


// input => algorithm => output

// indgridients => algorithm of frying => fried chicken

// DRY – don't repeat yourself

/*

algorithm of frying chicken:



1. put utensil on the stove

2. put oil

3. chop ingridients

4. add chopped indgridients

5. fry

*/

const ingredients = ['chicken fillet', 'onion', 'hot pepper', 'carrot'];



const bottleOfOil = 'oil';

let onStove = null;

let timer = 10;

const utensil = 'kazan';

function putOnStove(dish) {

if (onStove === null) {

onStove = dish;

console.log(`${dish} is on the stove`);

} else {

console.log('the stove is occupied');

}

}

function emptyStove() {



if (onStove !== null) {

onStove = null;

console.log('the stove is empty now');

} else {


console.log('the stove is already empty');

}

}



putOnStove(utensil);

//emptyStove();

putOnStove('pan');

function chop(indgridient) {

console.log(indgridient + 'is chopped');

return `chopped ${indgridient}`;

}

//function



function fry() {

putOnStove(utensil);

for (const indgridient in boxOfVeggies) {

const chopped = chop(indgridient);



console.log(`${chopped} started frying`);

}

}
Download 1.64 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling