Math.pow()

  • 0
  • 1
  • Question
  • Updated 4 months ago
  • Answered
I am trying to recreate a loan calculator I had originally created in javascript. The problem is I cannot find a workaround for the Math.pow() method. I would like to do this without IOL and stick to QuickBase formulas 

const principal = parseFloat(amount.value)
const calculatedInterest = parseFloat(interest.value) / 100 / 12
const calculatedPayments = parseFloat(years.value) * 12

// Compute monthly payment
const x = Math.pow(1 + calculatedInterest, calculatedPayments)
const monthly = (principal * x * calculatedInterest) / (x - 1)

if (isFinite(monthly)) {
monthlyPayment.value = monthly.toFixed(2)
totalPayment.value = (monthly * calculatedPayments).toFixed(2)
totalInterest.value = ((monthly * calculatedPayments) - principal).toFixed(2)

//Show Results
document.getElementById('results').style.display = 'block'

//Hide Spinner
document.getElementById('loading').style.display = 'none'
} else {
showError('Please Check Your Numbers')

}
Photo of Michael Curtis

Michael Curtis

  • 596 Points 500 badge 2x thumb

Posted 4 months ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 53,762 Points 50k badge 2x thumb
what does math.pow do?

There is a native exponent function in Quick Base

 for example

10^2 = 100

^ means "to the power of"

Photo of Michael Curtis

Michael Curtis

  • 596 Points 500 badge 2x thumb
Ha, that simple! thank you