fixed JavaScript example