dynamic js counter implemented