Lesser code in Jquery but same output.