Concurrency is about handling several tasks by moving between them. It's like a chef working on different dishes by switching tasks: chopping vegetables for one, then stirring another, then going back to chopping. The tasks are progressing over time, but they're not happening at the exact same moment.
Parallelism means doing several tasks at the same time. It's like having multiple chefs, each cooking their own dish at once. To achieve real parallelism, you need multiple processors or cores.
Diagram:
The concurrency diagram shows how a single CPU switches between Task A and Task B. While it appears they're running at the same time, they're actually taking turns.
The parallelism diagram shows two cores, each running its own task at the same time. Task A and Task B are truly happening at the same time.
A practical note: Even though JavaScript runs on a single thread in the main thread, it uses concurrency with its event loop to manage multiple tasks. Web Workers enable parallelism in JavaScript by running code in different threads.