Update dictFunc.js

Removed some unnecessary parts and replaced with much more efficient and shorter code.  Also converted functions into string methods in order to prevent type errors.