Updated example JS code