Update 003.js

I thought there might be a slightly simpler implementation. That said, I'm not certain about the performance side.