Hola Interview Question

1) Create validation function. 2) Optimize javascript function.