working example of javascript