What is JavaScript primarily used for in web development?
A) Designing the layout and visual appearance of web pages
B) Creating interactive and dynamic features on web pages
C) Managing server-side databases and data storage
D) Writing and compiling executable programs for operating systems