JSFiddle - React, Tailwind, and code Playground

JavaScript

class Queue{
	constructor(){
  	this.queue = [];
    this.length = 0;
  }
  addToQueue( c ){
  	this.queue.push(c);
  }
  getLength(){
  	while( this.queue.length > 0 ){
    	this.execute();
    }
    return this.length;
  }
  execute(){
  	this.queue.pop();
    this.length++;
    if ( this.queue.length <= 0 ) return this.length;
    else { return false }
  }
}

class String{
  constructor(s){
  	this.s = s;
  }
  getLength(){
  	let length = 0;
    let queueueueueueue = new Queue();
    ('' + this.s).split('').forEach( val =>{
       queueueueueueue.addToQueue(val); 	
    });
    return queueueueueueue.getLength();
  }
}

class StringLengthGetter extends String{
	constructor(s){
  	super(s);
    this.getLength = null;
  }
  getLengthProxy(){
  	return super.getLength(s);
  }
}

let s = new StringLengthGetter('Hello world');
document.body.innerText = `String length of ${s.s} = ${s.getLengthProxy()}`