created switch statement using JS