Created
September 14, 2022 18:09
-
-
Save marktellez/4cfe7dfa4d75432b1d92ebb97cb93a39 to your computer and use it in GitHub Desktop.
parity pricing closure using javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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