A validation checker in JavaScript