Resolving js errors