JSFiddle - React, Tailwind, and code Playground
JavaScript
function getLength(str){
let count =0;
let i=0;
while(true){
if(typeof str[i]==='undefined'){
break;
}
count = count+1;
i++;
}
return count;
}
alert(getLength('hello'));