JavaScript data structures and algorithm used in texting my knowledge on problem sovling and conditional statement (if else and switch statemt)