Skip to content

Instantly share code, notes, and snippets.

@marktellez
Created September 14, 2022 18:09
Show Gist options
  • Save marktellez/4cfe7dfa4d75432b1d92ebb97cb93a39 to your computer and use it in GitHub Desktop.
Save marktellez/4cfe7dfa4d75432b1d92ebb97cb93a39 to your computer and use it in GitHub Desktop.
parity pricing closure using javascript
function getNextPrice(start=100, step=25) {
let currentPrice = start
return function() {
const newPrice = currentPrice
currentPrice = newPrice + step
return newPrice
}
}
const pp = getNextPrice(100, 15)
const np = getNextPrice(500, 25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment