functioning without error msg
removed try catch
working javascript