some js

Spelling and correct checks against 0 and null
forgot one..
Merge pull request #274 from Hellowlol/legth

type checking