count
spaces.String.prototype.replace()
with a regular expression and String.prototype.repeat()
to replace each tab character with count
spaces.const expandTabs = (str, count) => str.replace(/\t/g, ' '.repeat(count));
expandTabs('\t\tlorem', 3); // ' lorem'
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️