javascript comment imprimer le répertoire de travail

var loc = window.location.pathname;
var dir = loc.substring(0, loc.lastIndexOf('/'));
Cautious Cicada