Nested Scopes Example

by Kondal Durgam

JavaScript

const humans = function(factor) {
	debugger;
	const ingredient = function(amount,unit,name) {
		let ingredientAmount = amount * factor;
		if (ingredientAmount > 1) {
			unit +="s";
		}
	console.log(`${ingredientAmount} ${unit} ${name}`);
	};
	ingredient(1, "can", "chickpeas");
};