using setinterval & settimeout functions