--- title: clear() slug: Web/API/Console/clear translation_of: Web/API/Console/clear --- <div>{{APIRef("Console API")}}</div> <p>Vide la console.</p> <p>Tous les messages de la console seront supprimés et remplacés par un message de confirmation ("Console was cleared").</p> <p>À noter: sur Google Chrome, <code>console.clear()</code> n'a aucun effet si l'utilisateur a coché "Preserve log upon navigation" dans les <a href="https://developer.chrome.com/devtools/docs/settings#preserve-log%20upon%20navigation">paramètres de l'inspecteur</a>.</p> <h2 id="Syntaxe">Syntaxe</h2> <pre class="syntaxbox">console.clear(); </pre> <h2 id="Paramètres">Paramètres</h2> <table class="standard-table"> <thead> <tr> <th scope="col">Paramètres</th> <th scope="col">Status</th> <th scope="col">Commentaire</th> </tr> </thead> <tbody> <tr> <td>{{SpecName("Console API", "#clear", "console.clear()")}}</td> <td>{{Spec2("Console API")}}</td> <td>Définition Initial</td> </tr> </tbody> </table> <h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> <p>{{Compat("api.Console.clear")}}</p> <h2 id="Voir_aussi">Voir aussi</h2> <ul> <li><a href="http://www.opera.com/dragonfly/documentation/console/">Opera Dragonfly documentation: Console</a></li> <li><a href="http://msdn.microsoft.com/library/gg589530">MSDN: Using the F12 Tools Console to View Errors and Status</a></li> <li><a href="https://developer.chrome.com/devtools/docs/console#assertions">Chrome Developer Tools: Using the Console</a></li> </ul>