JSFiddle - React, Tailwind, and code Playground

by nerdycap007

JavaScript

let total = 0
let price = 10
let quantity = 4
let storage = []

let target = () => { total = price * quantity}

let record = () => { storage.push(target) }

let replay = () => { storage.forEach(run => run()) }

console.log(total)

target()
record()

console.log(total)

price = 11
replay()

console.log(total)