how to create method in javascript and how to call it