Another approach for Bob example in javascript

Another approach for Bob example in javascript