JavaScript Snippet, handle integers