Skip to content

Instantly share code, notes, and snippets.

@ashryanbeats
Created February 18, 2012 02:12
Show Gist options
  • Save ashryanbeats/1856923 to your computer and use it in GitHub Desktop.
Save ashryanbeats/1856923 to your computer and use it in GitHub Desktop.
Conditionals in Javascript Project 2.5
var calculateTotalCosts = function(salary,numWorkers,city){
var fixedCosts = 5000;
var variableCosts = salary*numWorkers;
if(city === "NYC"){
return fixedCosts+variableCosts+30000;
} else {
return fixedCosts+variableCosts;
}
}
calculateTotalCosts(30000,7,"NYC");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment