Drill

ProblemsTypeScript › finance

Variance from budget

easyfinanceTypeScript

A ledger compares what was planned against what actually happened: report the signed difference.

budgetVariance(budget: int, actual: int) → int

Solve it in the editor →

Where you start

function budgetVariance(budget: number, actual: number): number {
  
}

Worked examples

CallResult
budgetVariance(100, 120)20
budgetVariance(100, 90)-10
budgetVariance(0, 0)0
budgetVariance(50, 50)0

Hint

Subtract budget from actual.

Reference solution in TypeScript
function budgetVariance(budget: number, actual: number): number {
  return actual - budget;
}

The same problem in another language

More finance problems in TypeScript