JavaScript - Scopes & closures

Practicing JavaScript scopes and closures.!

by Codi Bezouka-Smith

JavaScript

/* What is a closure? */
function withSalesTax (taxRate) {
	console.log(taxRate);
	/*
	return function (price) {
		return Number((price * taxRate).toFixed(2));
	}
	*/
}
var withLowTax = withSalesTax(1.1);
var withHighTax = withSalesTax(1.2);
console.log(withLowTax(12.99));