How to use frequency concept using javascript......