validation javascript objects