check if path exists javascript