adding the github working example javascript code to test