Find power of a number in javascript