# Introduction In this lab, we will explore how to compact whitespaces in a string using JavaScript. We will utilize the `String.prototype.replace()` method and a regular expression to replace all occurrences of two or more whitespace characters with a single space. This will help us to effectively format and clean up text data in our web applications.
Click the virtual machine below to start practicing