How to write a if else condition inside a function using javascript

Published --