improve implement of formatAs, shortter with equal even better speed under older browsers